lua-users home
lua-l archive

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


Sorry for this really simple question but at the moment I can not find the
answer by myself although I think it's really simple. If I have a function
that returns more than one value - how do I get them into a table? I need
something like this:

function test()
  result = some table of results
  return unpack(result)
end

local t = {}
t = pack(test())
print(t[2])

Unfortunately there is no pack command, but I am sure it can be done
somehow. Please assume that I can't change the function itself, otherwise
the best solution would be to change the function to "return result" of
course ;-)

Thanks,
Michael

-- 
...using RiscLua 4.14, built from Lua 5.1.3