lua-users home
lua-l archive

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


Hi Michael,

  pack = function (...) return arg end

Cheers,
  Eduardo Ochs
  http://angg.twu.net/

On Thu, Jul 17, 2008 at 12:06 PM, Michael Gerbracht <smartmails@arcor.de> wrote:
> 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
>