• Advertisement
Sign in to follow this  

Separation of C++ and Lua

This topic is 3728 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

What are common practices for separating C++ code from Lua script? The more Lua I can use, the better I am because it doesn't require a recompile. But how does one decide when to write the objective in C++ or Lua? Obviously my OpenGL routines will be in C++. But I want object spawning and all that other fancy stuff in Lua script if possible. What is everybody's common practice for deciding? Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
I think people could give you wildly different answers. There's an argument for writing everything in Lua until you discover a performance problem, at which point you shift that bit into C++. Others might take the opposite approach, of deciding what they want do in scripts, and writing bindings for C++ functions as they discover that need them.

Personally I would probably decide why I want scripting, plan out a few sample scripts, and then work out from that which objects and functions I need to expose.

Why are you integrating Lua, what kind of game is it, and who are your scripts aimed at? Issues such as performance and ease of use become more or less important based on these factors.

Share this post


Link to post
Share on other sites
well, in my opinion, the base of the engine should be written in C++.
just script ur AI or bind lua to C++ classes so u can create new sprites and stuff from lua.
but, if u want to have classes and inheritance in lua this could get messy and slow.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement