lua-users home
lua-l archive

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


>> If switch construction is what you need, I guess there are 2 ways:
>>
>> 1. Write a pointer->number hash and use it like
>> switch (lookup (L, lua_tostring (L, 1))) {
>> case 0:
>> case 1:
>> ...
>> }
>>
>> 2. Write a patch to Lua yourself, put it somewhere into
>> http://lua-users.org/wiki/LuaDirectory
>> and maintain to keep it up-to-date.
>>
>>
>>
> #1 is what I'm doing right now, #2 is what I'm considering to do if I can't
> get it from a standard Lua API call.

You mean, you use pointer->number hash lookup, not C-string->number
like in luaL_checkoption (), right?
If yes, could could you please send out your code. I may find it very handy.