Topic: addFunction issue
I have no idea whether this is a bug, or something silly I'm doing.
I have a collection of functions I'm trying to add to lua. As far as I know, I'm registering them correctly:
MEngine* engine = MEngine::getInstance();
MScriptContext* script = engine->getScriptContext();
if(script)
script->addFunction("broadcastMessage", ScriptBroadcastMessage);
int ScriptBroadcastMessage()
{
//...
}
I've tried registering the functions on MGame::MGame(), as a static object when the plugin is loaded, and on the first update of MGame. I've checked the value of broadcastMessage from lua on the first update, and on 10th update, and it's always nil.
As I have said, this is probably my fault, but I can't see what I'm doing wrong...