Hi,
Going a bit crazy over this one, looks like a bug but it might be because I’m a newbie…
When I do a score comparison before saving a best score value it with the beebegame class I do the following
[lua]–check for the best score
local function checkScore()
print(“checkScore function”)
print(“score =”)
print (_score)
print(“best score =”)
print(_bestscore)
if (_bestscore ~= _score) then
game.saveValue(“BestScore.data”, _score)
_bestscore =_score
end
end [/code]
I get this error when both strings return a numerical value from the print just before it:
checkScore function
score =
60
best score =
100
Runtime error
…+sE+82P4w6kDYjg++++TI/TemporaryItems/190/level02.lua:58: attempt to compare number with string
stack traceback:
If I change >= to ~= it the code works but don’t save proper best score values of course.
Any help would be appreciated.
Cheers
[import]uid: 10517 topic_id: 8630 reply_id: 308630[/import]