[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua binding: How to implement C enum
- From: Mike Pall <mikelu-1112@...>
- Date: Sat, 17 Dec 2011 20:33:54 +0100
Mark Hamburg wrote:
> If worrying about speed, [...]
... then you'll probably use LuaJIT, anyway. And the FFI already
has support for automatic string -> enum conversions:
ffi.cdef[[
typedef enum { FOO = 11, BAR = 22 } MyEnum;
void mycall(MyEnum x);
]]
ffi.C.mycall("BAR") --> is automatically turned into mycall(22)
--Mike