I am working on a plugin for Skillz. So far it works great. Everything is implemented. From a plugin perspective, I have methods that fire events that return an event to Lua side and I have the Skillz UI showing up when it is supposed to.
The only issue that I have is the Skillz random number generator call. I can’t wait for this call to fire an event, I need this method to return immediately.
So what I have tried. If you look at some of the enterprise plugins in github they just push the value to the stack like this (in my mind this doesn’t make any sense, but I assumed it worked at some point):
int chartboostLibrary::getPluginVersion( lua\_State \*L ) { lua\_pushstring( L, pluginVersion ); return 1; }
On one of the corona examples on one of the tutorial pages, they call CoronaLuaDoCall( L, 1, 0 ) after pushing the value to the stack. I am not 100% sure what that call does, but in my code, it doesn’t work either. It throws an error.
So here is my actual code:
NSUInteger randomNumber = [Skillz getRandomNumberWithMin: (NSUInteger)lua\_tointeger(L, 3) andMax:(NSUInteger)lua\_tointeger(L, 4)]; NSLog(@"Random Number: %lu", randomNumber); //This does nothing as expected. lua\_pushinteger( L, randomNumber ); //Calling this after throws an error. CoronaLuaDoCall( L, 1, 0 );
Any help would be appreciated. And as mentioned before the methods where I fire an event work as expected.