lua-users home
lua-l archive

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




On Mon, Aug 11, 2008 at 4:25 PM, Ben Kelly <ranavin@gmail.com> wrote:
If using alpha compilers gives you the heebie jeebies, you can also do
something like this:

function L(args)
 return function(exp)
   return assert(loadstring("return function("..args..")"
     .." return "..exp.." end"))()
 end
end

You probably want to perform some compilation caching, indexing compiled functions with their source, so that you keep acceptable performances when lambdas occur in loops (i.e. virtually always).

-- Fabien.