I have code that wants to get some additional return values from a function and pass them forward last by:
local ok, ... = coroutine.resume(co)
do_stuff(ok)
return ...
However, this will not be performed, since ...in assigning a variable is a syntax error.
I could get around this limitation using the old "function arguments and equivalent variables" trick and function call immediately
return (function(ok, ...)
do_stuff(ok)
return ...
)(coroutine.resume(co))
but I think that would not be very idiomatic or effective. Are there any smarter ways to solve this problem of handling the remaining values returned by the call resume?
EDIT: By the way, this is necessary to work with nilvalues in extra arguments
EDIT2: , .