lua-users home
lua-l archive

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


Hi,

I am using LuaJIT. I need to pass the result of one function to another function. The first function has multiple return values. This is the code I am using.

  local t = {functionFirst()}
  functionSecond(unpack(t))

This works mostly, but fails if one of the return value is nil. The first function is defined by the end user, so I can not control it.

How to detect the number of return values? If I can know how many values are returned from first function,  this should work.

  functionSecond(unpack(t, 1, count))

Thanks!

Chris