On any platform, the Catalog scoreboard API on the SDK accepts to call addScore() with a negative score value.
Instead of accepting it and wrapping around the negative number around a very high 32bits integer, the SDK should throw an error the same way that it would throw an error for an invalid scoreboard name.
Here’s a typical piece of
local score = -1
playdate.scoreboards.addScore(scoreboard, score,
function (status, result)
if status.code == "ERROR" then
print(status.message)
end
end)
For instance, this piece of code should definitely throw an error instead of submitting something like 4,294,967,295.
This probably also happen on the C SDK but I didn’t test this.
Seems appropriate enough… but in Lua I can definitely tell you that you can send negative numbers and they even display as such in the Lua UI I have but if you take a look at those scores (see screenshot just below) you clearly understand the problem :
no but the real problem I have is that the Lua SDK doesn’t throw an error when you call addScore with a negative number… I’d prefer if it threw an error instead of accepting a 4 Billion score
(Duplicating our discord chat for the general public )
I've got this filed for 3.1, ftr. Since the function doesn't currently have a return value indicating an immediate error I'll have it send the error to the callback. Thanks for catching this!