Game Center and escaping the Lua sandbox...

I have started a tutorial on integrating Game Center into a Codea App ( This is all fairly straight forward until I need to save a score or achievement. The difficulty is that all the Game Center code needs to be done in Objective C so I need a way for my Codea lua code to exchange information with or trigger a method in say the CodifyAppDelegate in the runtime (although just about anywhere in the Objective C code would do since I can always get back to the App Delegate).

I can bodge something up using NSUserDefaults or some other pList but ideally I would like to create some sort of call back or delegate in Objective C which gets triggered from within the lua project code.

In addition, I would like a button in my Lua code to be able to trigger a method in Objective C (so for example the user can bring up the Game Center view to check high scores in their App). I suspect solving the first problem will also solve this one. I can probably just overlay a button on the Codea view in Xcode but this doesn’t seem like an elegant solution. I also seem to remember that mixing UIKit and OpenGL can lead to problems, but I could be wrong.

So before I tear off down the wrong road, does anyone have any suggestions on how this might be done?

.@Reefwing I have no idea, but @juaxix made some classes for Game Center and music a while back. you could probably ask him how he did it for his game.


Thanks @veeeralp - I will check it out.

This looks perfect! I will give it a go.

awesome. I seriously can’t wait for Universal Apps and iAds. Your tutorials are the reasons why I’m this far