[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Can I bind a function with callback to lua?
- From: "Ashwin Hirschi" <deery@...>
- Date: Sat, 26 Feb 2005 19:49:23 +0100
If he wants to store the callbacks (as most often is the case with
them) then the sample won't do.
That's not what was asked. Adam's example was pretty clear.
To Ashwin: the trick lies in using the Lua registry (try looking for
that in manual, list archive, wiki..) to tie a Lua item (the function)
to a unique integer (that'll be the function handle, sort of).
Eh? I wasn't the one asking the original question, but the one providing the fragment.
You're right about lua_ref/unref et al [including the registry], though.
Oh yeah, these functions have been moved/renamed, since Lua 5... I wish they'd be put back into the "official" [read: documented in the ref manual] part of the Lua API.
It looks like the technique is now referred to as a "trick". I think that's bad: it's far too essential. Now it leaves newbies clueless. Ah well.
no signature is a signature.