Original Post
Hi, I want to have a class representing a game object and I want to be able to have access to it from both lua and c++.
Right now I parse my scene file and call this code to create objects:
luabind::object myObject = globals(L)[name]["__init"]();
GameObject *gameObject = luabind::object_cast ( myObject );
This does call the luabind object and return the game object. I have verified this by changing the "name" value in my lua constructor and printing it out in the GameObject update function on the c++ side. The problem is I dont know how to continue to call lua functions on this object. Does anyone have any ideas?
EDIT: So since the lua __init function called above can change members on the game object, I have no idea why this wouldnt work:
luabind::object myObject = globals(L)[name]["__init"]();
myObject["update"]();
Calling update makes it crash. And if i call update in the constructor of the derived lua class, it calls the c++ GameObject update D=
Right now I parse my scene file and call this code to create objects:
luabind::object myObject = globals(L)[name]["__init"]();
GameObject *gameObject = luabind::object_cast
This does call the luabind object and return the game object. I have verified this by changing the "name" value in my lua constructor and printing it out in the GameObject update function on the c++ side. The problem is I dont know how to continue to call lua functions on this object. Does anyone have any ideas?
EDIT: So since the lua __init function called above can change members on the game object, I have no idea why this wouldnt work:
luabind::object myObject = globals(L)[name]["__init"]();
myObject["update"]();
Calling update makes it crash. And if i call update in the constructor of the derived lua class, it calls the c++ GameObject update D=