If I have class
class Game {
public:
Game() { level = new Level(); }
private:
Level *level;
lua_State *L;
}
Where the level class has member functions such as "addObject()", how can I use that instance of the level class to bind addObject into the lua state?
The lua file may contain:
addObject("Player", 100, 100)
addObject("Enemy", 200, 100)
So to clarify, the 'Game' class contains a class 'Level' to manage things like the objects + there movement etc... Then I want to call a lua script to load the current level, which will bind the instance of 'Level' in the 'Game' class so it can call addObject() from the lua code.
I believe this is possible via LuaBind however I'm not keen on the boost dependencies, I did come across https://stackoverflow.com/questions/32416388/how-to-register-member-function-to-lua-without-lua-bind-in-c however method 1 seems to reply on 'Game' being a singleton and on method 2 I failed to bind a member method, only a normal function. If all else fails I will revert to LuaBind with it's awful dependencies.