lua-users home
lua-l archive

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


On Fri, 2010-10-29 at 12:42 -0700, Jonathan Castello wrote:
> 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

True, it would, I wasn't thinking at the time... :)