[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua binding: How to implement C enum
- From: Ezequiel García <elezegarcia@...>
- Date: Sat, 17 Dec 2011 14:43:50 -0800 (PST)
Hi Mark,
--- El sáb 17-dic-11, Mark Hamburg <mark@grubmah.com> escribió:
> De: Mark Hamburg <mark@grubmah.com>
> Asunto: Re: Lua binding: How to implement C enum
> Para: "Lua mailing list" <lua-l@lists.lua.org>
> Fecha: sábado, 17 de diciembre de 2011, 17:26
> If worrying about speed, the answer
> is probably to stash a table or two somewhere that can be
> used to the string-to-enum and enum-to-string mappings. Say,
> for example, that you define your mapping in C code as
> something like (untested, uncompiled, written in e-mail,
> caveat, caveat, caveat):
Well, you read my mind!!! I was thinking about the same thing.
Plus, for the return value, I thought on returning a userdata that implements
a 'contanins()' function. So for the user, it looks simple enough:
s:SetCapabilities('ONE,TWO,THREE')
caps = s:GetCapabilities()
if caps:contains('ONE,TWO') then
-- stuff
end
I'll post it here when I have it cooked :)
Thanks,
Ezequiel.