lua-users home
lua-l archive

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


>>From: Eric Ries
>>toLua output
>>1. toLua doesn't convert enumerated types correctly (although this is not
really toLua's fault, since it doesn't deal with enumerated types
explicitly), so we have to cast them to int first.

I assume you're having problems accessing enumeration in classes? I got
round this by doing:

In pkg:
$#define WIDGET_STATE WidgetBehaviourNode::STATE

typedef enum {
 WidgetBehaviourNode::NONE @ STATE_NONE     // etc
}WIDGET_STATE;

class WidgetBehaviourNode
{
 void setState(WIDGET_STATE s);
};

class Other
{
    void something(WIDGET_STATE s);  // which I have trouble with without
workaround.
}

So you have to bodge in another type to access enums in other classes.

>>2. MS VC++ doesn't like the way toLua handles bool values, so have to
change
foo = (bool) (tolua_getbool(..));
to
foo = (tolua_getbool(..) != 0);

Yep - I would like this changed as well please.

>>toLua input
1. toLua misinterprets char const * but handles const char * correctly
2. toLua cannot handle unions within structs, but works fine if you remove
the union keyword and associated braces
3. toLua cannot handle regular unions, so they have to-be removed, etc.

Havent encountered the above. ie. have no unions!