lua-users home
lua-l archive

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



the 'trick' reference was just by me :) and sorry about the name messup, tried to get it right (but did not).

-ak


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], 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.

Ashwin.
--
no signature is a signature.