lua-users home
lua-l archive

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

but how can I run that lua function in C? can I at all?
I thought about converting the logical operators but in any case I would have to parse the lua stack (with lookahead to make the associativity of the operators to work correctly) and I think this might be too costly

again my question might have been badly formulated

but with "transfer" I mean I want C to evaluate it for me

On Wed, Oct 19, 2011 at 3:27 PM, steve donovan <> wrote:
On Wed, Oct 19, 2011 at 3:19 PM, Oskar Forsslund
<> wrote:
> 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

You would need to wrap it as a table structure


and 'interpret' that structure. This might be acceptable if your
functions are relatively expensive.

But then, what stops you from passing a Lua function?

function() func1() and func2() and (func3() or func4()) end

(could be cached)

steve d.