[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Possible enhancements for Lua 5.2
- From: Rebel Neurofog <rebelneurofog@...>
- Date: Mon, 27 Jun 2011 02:52:46 +0400
>> 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.