[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Can I bind a function with callback to lua?
- From: Asko Kauppi <asko.kauppi@...>
- Date: Sat, 26 Feb 2005 21:22:00 +0200
the 'trick' reference was just by me :) and sorry about the name
messup, tried to get it right (but did not).
26.2.2005 kello 20:49, Ashwin Hirschi kirjoitti:
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],
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
no signature is a signature.