lua-users home
lua-l archive

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

William Ahern <> writes:
>> It never occurred to me to try integer keys (or rawgeti), but as that
>> presents additional issues (e.g., one must come up with a system to
>> assign small-integer keys without conflicts), and has no particular
>> library support (luaL_checkudata etc), it seems like I may as well
>> just use upvalues when possible (and upvalues of course have the
>> advantage of being a local namespace, with no namespace conflict
>> issues).
> If you use lightuserdata there's no namespacing conflict, assuming a flat
> process address space. Just take the address of a function, or if casting
> function pointers to void pointers is distasteful, define a static const
> variable and use its address.

Hmm, then you presumably don't get the same speed advantage as small
integers, right?  I guess hashing a lightuserdata might be faster than
hashing a string, although I dunno how much for short strings...


97% of everything is grunge