[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: how to store multi return value provisionally?
- From: Michal Kottman <k0mpjut0r@...>
- Date: Mon, 20 Dec 2010 13:56:14 +0100
On Mon, 2010-12-20 at 20:48 +0800, starwing wrote:
> i.e. i want to do that:
>
> ??? = coroutine.resume(...)
> if ???[1] then
> --- do something with ???[1...]
> else
> --- do something with ???[1...]
> end
>
> but I don't want to use table, I just wonder it's possible to
> implement it just operate the multi-values itself.
Create locals from them. For example, if your thread yields 3 values:
local ok, val1, val2, val3 = coroutine.resume(...)
if ok then
-- do something with 'val1', 'val2', 'val3'
else
-- 'val1' is the error message, process it
end