#Table

Does #Table gives the number of values in the table having an integral key? Cause if I use strings or non integral numbers it doesn’t count it in #Table. Why is this so?

function setup()
    Table = {}
    Table["String"] = "one"
    Table[1] = 1
    Table[1.1] = 1.1
    print(#Table, Table["String"], Table[1], Table[1.1])
end

“The # operator doesn’t count all the items in the table (!), instead it finds the last integer (not-fractional number) key.”

And see here:
http://stackoverflow.com/questions/2705793/how-to-get-number-of-entries-in-a-lua-table

Thanks @Ignatz! Had googled it but couldn’t find it.

:wink: Google knows most things…

Stackoverflow knows most things as well :wink: