lua-users home
lua-l archive

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


Just wanted to say thanks for all the replies (and sorry for not checking
the wiki).  Very useful.

Cheers,
Andrew

andrew cooke said:
>
> Hi,
>
> As far as I can tell, Lua evaluates arguments to functions eagerly.  Is
> there any way of treating blocks of code lazily?
>
> For example, if I want to add a "case" statement to Lua that looks
> something like:
>
> case x
> of   1 do ... end
> of   2 do ... end
> else   do ... end
>
> would I be able to?  My initial idea was to define case as a vararg
> function, but if arguments are evaluated eagerly then this won't work (I
> believe).
>
> The syntax in the example above isn't important - what I'm looking for is
> a way of handling sections of code as first class objects, and for them
> not to be evaluated when passed as arguments, I think.
>
> Cheers,
> Andrew
>
> --
> personal web site: http://www.acooke.org/andrew
> personal mail list: http://www.acooke.org/andrew/compute.html
>
>


-- 
personal web site: http://www.acooke.org/andrew
personal mail list: http://www.acooke.org/andrew/compute.html