lua-users home
lua-l archive

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

Hi Mark,

--- El sáb 17-dic-11, Mark Hamburg <> escribió:
> De: Mark Hamburg <>
> Asunto: Re: Lua binding: How to implement C enum
> Para: "Lua mailing list" <>
> 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:


caps = s:GetCapabilities()

if caps:contains('ONE,TWO') then
  -- stuff

I'll post it here when I have it cooked :)