Jump to content
  • Advertisement


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


Can you do this w/ lua?

This topic is 5549 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!