lua-users home
lua-l archive

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


> That is cute.  The basic problem is how to 'quote' an operation so
> that it can be executed later.

I don't understand what this "quote an operation" problem is. What I
do is to parse (string.find) the string, extract expressions within
curly braces and eval then as Lua functions, with a special
environment which knows about locals, and then insert back the
tostring()'ed version of the result, and that's it.

The cost of mine approach? One string literal when the assertion
expression evals to true, or some closures and tables when it
evaluates to false, but considering that you don't want them to
evaluate to false, it is not much cost at all.

--rb