9

I am reading a few tutorials on Lua and am trying to figure out how to use unpack(). I found an example that goes like this:

t = { "the", "quick", "brown" }

print (unpack (t))

The output should be "the quick brown".
What actually happens is this: "stdin:1: attempt to call a nil value (global 'unpack')".

How can I make unpack() work?

My Info:
OS: Mac OS 10.8
Lua: 5.4.2

user1766438
  • 492
  • 4
  • 13

1 Answers1

19

Since Lua 5.2 unpack function is now at table.unpack

Function unpack was moved into the table library and therefore must be called as table.unpack.

Spar
  • 1,582
  • 9
  • 16