[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: void* in Lua_State for Application?
- From: Miles Bader <miles@...>
- Date: Tue, 10 Sep 2013 14:58:31 +0900
William Ahern <william@25thandClement.com> 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
> 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