[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Passing functions addresses to tolua classes
- From: "jose_marin2 <jose_marin2@...>" <jose_marin2@...>
- Date: Mon, 03 Feb 2003 18:42:12 -0000
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. ^_^
>
>