In the outcome of this it prints both strings, how can I make it only print the first one?
ta = {"123335","123124124"}
print(table.unpack(ta))
In the outcome of this it prints both strings, how can I make it only print the first one?
ta = {"123335","123124124"}
print(table.unpack(ta))
table.unpack and table.pack are purely Lua 5.2+ features. That being said, unpack is still the wrong tool for the job here. If you only care about the first entry in the table, unpacking the entire thing is not necessary. Just index the array for it's first element:
local ta = {"123335","123124124"}
print(ta[1])
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
exactly (pack is a thing?)
Ask JavaScripts shift, pop, push:)