lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

> CallbackManager.postMyCallback(wrap(myInstance).instanceMethod)
> where:
> function wrap(instance)
>   return setmetatable({}, {__index=function(_, method)
>     return function(...)
>       return instance[method])(instance, ...)
>     end
>   end})
> end
> This could be a good starting point to implement the colon syntax
> extension proposal with a simple token filter.

Coming from a constrained memory environment, that is really scary as you are
creating two tables, a closure and a vararg function, a lot of overhead IMO.  I
do love however, that lua provides the functionality to do things like this, I
just wish you could do it cheaper.