Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I get it to print 2(the lowest number) with table sort?

Im pretty new to scripting so if someone could try to help me understand why this is printing nil instead of the lowest number that would be great since I'm currently trying to learn about tables

local DaBestNumbers = {2, 3 ,4 ,6, 9, 12}

table.sort(DaBestNumbers) print(DaBestNumbers["1"])~

2 comments

0

print(DaBestNumbers[1])

0

thx man

1 answer

local DaBestNumbers = {2, 3 ,4 ,6, 9, 12}
table.sort(DaBestNumbers)
print(DaBestNumbers[1])

I don't need to explain it, the code explained itself.

More details of table's methods and function: Lua.Org

This discussion is preserved as it was. New answers, comments, and votes are closed.