The best thing I can compare what I need is variadic functions:
function doStuff(...) print(...) end
But, the other way around, if you will. If I had a function I needed to return the result of, I would do it like so:
return func()
But if I have that in a protected call, and don't know the amount of return values, how would I do that? I tried this:
local r = {} pcall(function(...) r = {remoteFunc:InvokeClient(...)} end) return unpack(r)
Which returns nil, whereas without the pcall it returns what I want it to. I'm pretty sure I could do this in a crude way,
local s, e1, e2, e3, e4, e5, e6, e7, eUntilLike100 = pcall(function() end)
But I was wondering if there's already a way to do this I'm not seeing? Other than that, I mean. Thanks in advance.
Do it the same way you already did.
local r = {pcall(func, ...)}; if r[1] then return unpack(r,2) else return error(r[2], 2); end;