SaveLocalData is returning lots of decimal points even when the number that I’m saving to it should only have one decimal points. Is this a bug or programming problem? heres a snippet from my code.
self.high = readLocalData("Highscore"..difficulty.state..self.symbol, 0)
self.adder = math.ceil(self.adder*10)
if self.adder/10> self.high then
self.high = readLocalData("Highscore"..difficulty.state..self.symbol)
@Mr_Ninja - why are you bothering to divide by 10 in the first place? Why not just store an integer?
How would you do that? I do that so that the time is down to 1.6 rather than 2. Math.ceil will take the time which was calculated (with a lot of numbers after the decimal) and convert it (let’s say 1.6354) to 16, and by dividing it by ten it takes it back down to 1.6. The reason I’m not just storing an integer is because it’s easier to read within the gameover class.
Why not store 16, and divide by 10 when you read it back in?
Ohhhhhh. Thats what ill do, but is there a reason why the calculations weren’t working in my code, or does saveLocalData not do calculation in the arguments?
It does, but computers often get rounding errors, I’m sure it has nothing to do with saveLocalData itself