lua-users home
lua-l archive

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


On Tue, 12 Jan 2010, Nevin Flanagan wrote:
>
> My biggest concern remains the challenge of getting values in or out of
> an "in" block. Right now the only ways to get a value out are to either
> extract it from the environment table or create a local before the block
> where it can leave its result; is there any hope for a way to pass
> values in and out via the stack, much as coroutine.resume and
> coroutine.yield do?

What's wrong with wrapping the block in a function?

> This would also help us solve the problem of wrapping code that is not
> informed about a specialized environment but expects arguments:

How about

	in (...) do return (function (...)
		body
	end)(select(2, ...)) end

Tony.
-- 
f.anthony.n.finch  <dot@dotat.at>  http://dotat.at/
GERMAN BIGHT HUMBER: SOUTHWEST 5 TO 7. MODERATE OR ROUGH. SQUALLY SHOWERS.
MODERATE OR GOOD.