lua-users home
lua-l archive

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


I should have been clearer. I mean without just writing it in C, I want to transfer the actual _expression_ from lua to C at runtime

On Wed, Oct 19, 2011 at 2:32 PM, Jerome Vuarand <jerome.vuarand@gmail.com> wrote:
2011/10/19 Oskar Forsslund <matrixsmurfen@googlemail.com>:
> Can anyone think of a good way to transfer logical expressions from lua to
> c.
> expressions like
> func() and func2() and (func3() or func4())

Just replace "and" with && and "or" with ||:

func() && func2() && (func3() || func4())

AFAIK the evaluation rules are the same as in Lua (ie. if func()
returns false, the three other functions won't be called).