Thanks Nick,
That’s clever! I’m new to programming and not yet comfortable with using tables associated with for loops. I see how your thing is working though and that’s the solution I was trying to figure out.
How would you handle the case of negative numbers? Would you set up a ‘twin’ table like “scale2” containing negative numbers assiocated with same scaling factors as:
local scales2 = {{ - 100, 0.7},{ - 1000, 0.8},{ - 10000,0.9},{ - 100000,1}}
on my own so far I only had managed to come up with this:
local function checkTotal () if not firstCheck then if Total \> 99 or Total \< - 99 then sumTotal:scale(.5, .5) firstCheck = true checkBack = true end end if checkBack then if Total \< 99 and Total \> - 99 then sumTotal:scale(2, 2) firstCheck = false checkBack = false end end
Considered the portion of screen I can allocate for the score text, this manages to handle the issue up to + and - tens of thousands.
Which is more than acceptable in my case.
But this raise another question for me as to how to sistematically proceed in case of infinite values.
For example I want ot create a simple counter application also using that scaling method for the graphic output of the value we are counting on.
Realistically such an app would be used to count up to tens (like sports score tallying) or hundreds at max, but theoretically there shouldn’t be a number limit.
So how do you expert developpers usually approach this kind of circumstance? You settle with, like in this case, leaving space for a ample but finite margin of ‘maneuver’ or you force yourself to prevent every single ‘paradox’ in your project (i.e. even if it’s very unlikely you’d put in a method to handle the case my user decides to count up to 100.000) ???
Thanks for the attention…