Hi All
I need to call below function from objective c class because i want access value from objective C to my PluginLibrary.mm Class. It works perfectly when I am calling it from PluginLibrary.mm
if ( lua_isfunction( state, 1) )
{
int functionRef = luaL_ref( state, LUA_REGISTRYINDEX );
dispatch_sync( dispatch_get_main_queue(), ^(void) {
// Fetch Lua function from registry, and push to the top of the stack
lua_rawgeti( state, LUA_REGISTRYINDEX, functionRef );
// Call the Lua function.
// 0 arguments passed to this Lua function. 0 expected results.
lua_call( state, 0, 0);
// Remove the native reference to the Lua function from the registry,
// so we don’t leak.
luaL_unref( state, LUA_REGISTRYINDEX, functionRef );
});
}
I am Saving lua state reference like this:
static lua_State* state;
PluginLibrary::Open( lua_State *L )
{
state=L;
}
How to callback from objective c to my plugin class.?
Please let me know if have any idea about the same.