lua-users home
lua-l archive

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


Sure, but "SetFunc" is a C++ class method!
If i was using C, it's easy to get the func address, but with tolua, 
I don't know how to do that...

> 
> In lua, functions are first-class values. You can store 
> them in variables just like other values. So just say:
> 
> function theClass:SetFunc(someFunc)
> self.myfunc = someFunc
> end
> 
> 
> function theClass:doDomething()
>   if self.myfunc then
>   self.myfunc()  
>   end
> end
> 
> And you're all set. ^_^
> 
>