lua-users home
lua-l archive

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


On Fri, Jun 13, 2014 at 7:58 PM, Tom N Harris <telliamed@whoopdedo.org> wrote:
On Friday, June 13, 2014 09:32:23 AM Philipp Janda wrote:
> There is even a Lua API function[1] that makes this kind of thing easier ...
> > Ross.
>
> Philipp
>
>    [1]: http://www.lua.org/manual/5.2/manual.html#luaL_checkoption

At risk of drifting yet further off-topic, does anyone else wish
luaL_checkoption would compare the strings in a more efficient way than strcmp
in a loop? Perhaps registering a table with the options as keys.

--
tom <telliamed@whoopdedo.org>


That's what I've been doing for enums. I forgot all about luaL_checkoption, but it seems so silly to use a strcmp() loop when you can use a table.

--
Sent from my Game Boy.