I want to register a function with Orbiter's lua interpreter so that it's recognised in scripts and in the lua console.
If I compile that code, and then input function() into the lua console, the function isn't recognised
I've probably misunderstood the purpose of oapiCreateInterpreter, I thought it returned a handle to the "global" interpreter.
Any help appreciated thanks.
Code:
//simple lua function
static int Lua_function(lua_State* L)
{
//just print to the screen to show that the function has been recognised
sprintf(oapiDebugString(), "LUA function recognised!");
return 0;
}
//in the module's constructor, I assume that's the best place:
//register LUA functions
lua_register(oapiGetLua(oapiCreateInterpreter()), "function", Lua_function);
If I compile that code, and then input function() into the lua console, the function isn't recognised
I've probably misunderstood the purpose of oapiCreateInterpreter, I thought it returned a handle to the "global" interpreter.
Any help appreciated thanks.