lua-users home
lua-l archive

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


On Jan 10, 2011, at 7:14 AM, Daniel Silverstone wrote:

> I suggested that in a conversation a few of us were having recently (not on
> list or IRC) and it was pointed out to me that pushing and then looking up a
> light userdata in a table, may be more expensive than a rawgeti invocation.

One way to avoid Lua refs, and avoid using the global registry, is to associate callbacks (and other Lua objects needed by C) with small integer keys in a related full userdata environment (known as a uservalue in 5.2). However, when a callback from C happens, there is no documented way to convert a userdata pointer (void *), AKA block address, to a Lua object. I.e., what is the inverse of lua_touserdata?

e