27 lines
325 B
Go
27 lines
325 B
Go
package objects
|
|
|
|
import "github.com/d5/tengo/v2"
|
|
|
|
const src = `
|
|
|
|
new := func() {
|
|
self := {}
|
|
self.def = func(name, method){
|
|
self[name] = func(...args){
|
|
return method(self, args...)
|
|
}
|
|
}
|
|
return self
|
|
}
|
|
|
|
export {
|
|
new: new
|
|
}
|
|
`
|
|
|
|
func GetModule() tengo.Importable {
|
|
return &tengo.SourceModule{
|
|
Src: []byte(src),
|
|
}
|
|
}
|
|
|