lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



Ummm, no... enclosing the function call in curly braces doesn't always do what you'd expect!

When the function returns a nil somewhere, you'll end up with a truncated list of return values after calling unpack on the result.

See Wim's old post here:

	http://lua-users.org/lists/lua-l/2004-04/msg00303.html

Ashwin.


On Sat, 10 Jul 2004 22:00:30 +0200, Erik Hougaard <erik@hougaard.com> wrote:
I would just do:

t = { test() } -- Enclose function call in { }

print(t[1])

/Erik


Michael Roth wrote:

Hello,

I'm new to lua. I would like to do the opposite of unpack(). Example:

function test()
  return 1, 2, 3
end

t = pack(test())

print(t[1])


But in Lua 5.0 there isn't a pack() function, right? Why not? other
solutions possible?


Michael







--
no signature is a signature