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

What does unpacking and packing a table do?

I could not find a good answer online, what does table.pack and table.unpack do?

1 answer

✓ Accepted answer

Unpack returns all the elements of the table as separate values: {1, 2, 3} becomes 1, 2, 3 Pack doesn't exist in Lua 5.1 (which Roblox uses).

local t = {1,2,3}
print(t)
print(1, 2, 3)
print(unpack(t))

Output

table: internal_id
1 2 3
1 2 3

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