This topic is now archived and is closed to further replies.


Can you do this w/ lua?

Recommended Posts

yodaman    188
Hiya *I havent bothered yet to really learn lua so im not sure what exactly it can and cant do* In the engine im making right now I plan on interfacing it with lua. The engine however uses quite a few enums, now if you had a cpp function like so: void SetStyle(BlendStyle pStyle), you would simple set the param with a member of the particular enum structure, but now in lua you wouldn''t have access to the enums (or is there a way to expose them to lua?) or would I probably just have to make the function take in a string and then use a switch statement...ex:
void SetStyle(char* pStyle)
   case ''transparent'':
        m_Blendstyle = BS_TRANSPARENT;
and also, is there a way to make pointers in lua to hardcoded classes? lua file...CMesh *m_tree; m_tree->style = "transparent" etc. Thanx a lot in advance! Cheers!

Share this post

Link to post
Share on other sites
Endurion    5408
For enums, just assign the values to lua variables, then you can use them just like in c.

The latter requires the use of lua tables; it will work, but you''ll have to register everything and encapsulate parameters.
Or you simple use one of the wrappers out there (i prefer luabind, it''s quite mighty; tolua would be an alternative too).


Share this post

Link to post
Share on other sites