[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Scheme's "delay" function in plain Lua?
- From: Jonathan Castello <twisolar@...>
- Date: Fri, 29 Oct 2010 12:42:56 -0700
On Fri, Oct 29, 2010 at 4:27 AM, Michal Kottman <k0mpjut0r@gmail.com> wrote:
> function delay(exp)
> local f = assert(loadstring("return function() return " .. exp .. "
> end"))()
> -- TODO: setup the env of f to lookup local variables
> return f
> end
Wouldn't this work without the extra function + call?
local f = assert(loadstring("return " .. exp))
-- setup the env of f
return f
~Jonathan