Separation of C++ and Lua

Started by
1 comment, last by jsaade 16 years, 5 months ago
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.
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.
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.

This topic is closed to new replies.

Advertisement