I need help integrating lua in my game. I know only a little about lua, since I just started learning scripting (in general). I've read tutorials about lua, but most of them are only tell me how to bind lua in c++ code (which I've managed to do that with LuaBind), or explaining features in lua.
Let's say I have a "Player" class and "Obstacle" class. Obstacle class have these functions :
class Obstacle {
// ... member vars
// functions that will behave differently based on script :
void onTouchPlayer(Player* player);
void onUpdate(float deltaTime);
}
onTouchPlayer and onUpdate is meant to behave differently based on script.
What confuses me is what to write in the script, and how to call it in c++? If I already have Player class exported to Lua with LuaBind, how can I, for example, kill player at onTouchPlayer() and move the obstacle randomly at onUpdate function with lua?