Size Limit For Table Cells?

NotBlaineNotBlaine Member Posts: 2
edited June 2012 in Working with GS (Mac)
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?

Best Answer

  • MotherHooseMotherHoose Posts: 2,456
    edited June 2012 Accepted Answer
    @ 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

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited June 2012
    I've never tried to concatenate an integer or real attribute... interesting idea. Over a certain value, integer/real attributes get converted to scientific notation. I believe this happens at 1,000,000 (1e+06). But I did verify that concatenating causes an issue with values over 7 digits (I get "nan" or "inf" as the Display Text value).

    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

  • NotBlaineNotBlaine Member Posts: 2
    Thanks guys!! We good.
Sign In or Register to comment.