lua-users home
lua-l archive

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


I'm working on a calculator program which uses Lua as its expression evaluator. I'd like to be able to offer extensible infix operators so you'd be able to write something like:

c = a func b

where a and b are numeric variables or expressions and func is a function. This would be evaluated as:

c = func(a, b)

At the moment I plan doing this by pre-processing the formula strings, but it occurs to ask if MetaLua or Token Filters could be used to add this to the language? It would be easier to disambiguate expressions like this if I already know that a token represents a function taking two parameters.

Any thoughts?