Size Limit For Table Cells?
NotBlaine
Member Posts: 2
I'm not sure if I'm just inherently doing it wrong...
Is there a limit to the size of an number inside of a cell? I tried both Int and Real and it really doesn't seem to like going over 6 digits.
I'm concatanating the existing value plus the integer of the button pressed. Everything is good until the 7th digit, which registers as a 0 regardless, next button press returns 'inf' in the debug.
Code I'm using is, basically:
tableCellValue( game.MainTable ,1,1) = tableCellValue( game.MainTable ,1,1)..1
on a button press.
Again. Works 6 times, but not 7. Help?
Is there a limit to the size of an number inside of a cell? I tried both Int and Real and it really doesn't seem to like going over 6 digits.
I'm concatanating the existing value plus the integer of the button pressed. Everything is good until the 7th digit, which registers as a 0 regardless, next button press returns 'inf' in the debug.
Code I'm using is, basically:
tableCellValue( game.MainTable ,1,1) = tableCellValue( game.MainTable ,1,1)..1
on a button press.
Again. Works 6 times, but not 7. Help?
Best Answer
-
MotherHoose Posts: 2,456@ NotBlaine
the scientific notation format is native to lua programming
… any whole number > 6 digits is converted
of course … the computer will easily perform mathematical operations on those values
as @tatiang says you can store the numerical values as textAttributes in your table
if there are nothing but numberCharacters in that textAttribute
…the computer will perform mathematical operations on that number
…as well as concatenate
this is a work around for display of larger numbers … extracting the millions
http://www.mediafire.com/download.php?16xavinbp40kzi3
perhaps you can use the concept in your tables???
then again with displays of larger numbers
it may be easier to convert the number to real type units
by dividing the number by the unitValue
EX:
for 1543000000 in billions
might be easier comprehended by showing the player: 1.543 billions
and the computer does do the math … 1.543e+09 (or tableCellValue )/1000000000
@};- MH
Answers
If you don't need to do calculations with the value, use a text attribute. If you do, well, you may have to find a different way to implement this, such as splitting the value into two attributes somehow.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User