I've seen it here and there but never understood what it is used for, could someone explain what unpack() is for?
✓ ANSWER ACCEPTED
Could someone explain to me what unpack() does and what it is used for?
2 answers
✓ Accepted answer
What is unpack used for?
Unpack is used for separating values in a table for example
local Table = {"g","o","o","d","a","d","m","i","n","s"} -- This is my Table
print(unpack(Table)) -- This unpacks the table and prints it as separate values
Output
g o o d a d m i n s
This prints all the content of the table in one line
local t = {"1","2","3","4","5"}
print(unpack(t))
Above code prints out each element in 't', starting from index 1. A brief explanation would be as follows:
unpack is a special function in Lua which receives a specified table and returns the elements in that table in consecutive order, starting from index 1.
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
They're called elements not "content"
Actually the things inside the table are the tables 'content' smart kid
I can’t tell if you’re serious or not, first you downvote a correct answer then you refer to elements as “things”