Codea 2.0 and saveScore() ?

Has anything changed in Codea 2 that would make my Game Center addon submit 0 scores?

Is the saveScore() function maybe undocumented but taking over the addon’s function?

Something weird is going on, it used to work … Hmmm …

Wow, same problem here. Tried to change the GameCenterAddOn using GKGameCenterViewController, but I’m too bad at this :frowning:

To get rid of deprecated issues?

I don’t think they’re causing this as the same addon worked fine in Codea 1.5x

I’ve now confirmed it, Codea 2 saveScore saves a 0 with an app that used to work

In Codea 1.5 and where the Game Center code and addon remained unchanged …

Anyone try publishing an app and their saveScore doesn’t work?

I put an NSlog and it shows the score being submitted, and the score is in the sandbox,

but when the app gets published the score being reported is 0

Same code used to work and it was submitting in Codea 1.5 - i’m lost …


All 3 of my apps lost the game center functionality. Some scores are there from 1.5

@Zoyt maybe you can help here?

@escape75, when the runtime function receives the number, is it always zero? Because there is an error with lua_tonumber that seems to pop up sometimes where it always returns 0

@escape75, when the runtime function receives the number, is it always zero? Because there is an error with lua_tonumber that seems to pop up sometimes where it always returns 0

Looks like your having the same bug as I did. Try this and see what is logs: NSLog(@"%f",lua_tonumber(L,1);. (This was not tested, let me know if it raises an error.)
See this thread for a temporary solution: http://codea.io/talk/discussion/4841/possible-bug-lua_tonumber-not-working-after-update-to-runtime#Item_5
@Simeon - Any idea whythis is happening to 3-4 people?

@escape75 - Use my GameCenter library here, which is more up to date: http://codea.io/talk/discussion/4221/objective-c-libraries-testflight-gamecenter-location-twitterfacebookcamera-roll-sharing-more#Item_9
For those having issues with lua_tonumber and have a iOS 7 build dependency, I’ll post the new code eventually.

Thank You! I’ll test this asap, but not sure if I’ll get to it tonight

I’m pretty sure I’m using lua_tonumber and in the simulator it seemed to work

but when the app got submitted it always seems to be 0 - but maybe not always?

I will try to work on the lua_tonumber, thanks for the hint.


It didn’t make sense to me because nothing was changed in the code,

and after going from 1.5x to 2.0 that part just stopped working altogether.


Oh and like I said I put an NSLog right when the Game Center submit happens

and in the simulator it was fine, but then I submitted the app and now it submits 0’s …

@Zoyt I’ll have a look at your library, I just re-wrote mine to fix the

deprecated issues after targeting IOS7 and 7.1 but didn’t resubmit my apps.

@escape75 - It seemed unpredictable for me. Try my temporary fix for lua_tonumber if you haven’t already. Thanks!

@Zoyt Ok you were right, it was lua_tonumber …


Take the following example, commented out part always produces 0

but only when running on a real device, and not in a simulator,- plus a fix

This of course assumes the score is always an integer, etc.



from LUA call "saveScore(12345)"

static int saveScore(struct lua_State *state)
{
    // [gameCenterAddOnInstance saveNewScore: lua_tonumber(state, 1)];
    [gameCenterAddOnInstance saveNewScore: atoi(lua_tostring(state, 1))];
    return 0;
}

- (void) saveNewScore: (NSInteger) score
{
    NSLog(@"score: %d", score);
    // we don't need to submit to Game Center, just a test.
}

Update: submitted new version with the fix above and scores work again !

Have you guys figured out why lua_tonumber(state,1) produces 0, but

atoi(lua_tostring(state,1)) works everytime, and will Codea 2.01 fix it?


Note that the 0 is only produced on a real device, and in simulator it’s ok …

I have the same problem. Thanks for the workaround! It works.

The same problem in Codea 2.1 but only in the 64 bit simulator.