lua-users home
lua-l archive

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


On Nov 4, 2009, at 12:35 PM, Patrick Donnelly wrote:

Use:

function b()
 local t = pack(pcall(a));
 if not r[1] then error("something") end
 return unpack(r, 2, r.n)
end

(this is what Roberto's code meant to be I think)

Note there is no closure cost here.

But there is the cost of the pack which may actually be higher depending on how many results you are dealing with v how many upvalues.

Mark