lua-users home
lua-l archive

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

Its possible to wrap enums in tolua. eg.
enum A { ONE,TWO,THREE };
class Blah { public: enum B { FOUR,FIVE,SIX}; };
but when I try and pass enums as parameters eg.
def: void setSomething(enum A a);
call: setSomething(ONE);
tolua complains that I am not passing an enum object, I am passing a number, which is correct. The reference is to a none typed number.
I assume the way round it is to somehow create an object and set the tag to the correct enumerated tag?
local val = ONE
settag(val,tag("enum A"))  -- I'm making this up as I go along.
Is this correct or have I missed something? If this is correct its a bit over the top I think.
I think the solution is something along the lines of: tolua needs to wrap enums in parameters as numbers but then cast them back to the correct enums at call time. Thoughts?

It is impossible to travel faster than the speed of light, and certainly not
desirable, as one's hat keeps blowing off.
 - Woody Allen