lua-users home
lua-l archive

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


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