[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Eval a Lua expression
- From: Eugen-Andrei Gavriloaie <shiretu@...>
- Date: Thu, 3 Apr 2008 00:38:19 +0300
On Apr 3, 2008, at 12:19 AM, Enrico Colombini wrote:
Eugen-Andrei Gavriloaie wrote:
3. I think the entire script will be executed entirely on each
lua_evaluate_expression because of lua_pcall(L,0,1,0). This is not
acceptable because I want to use this approach on other occasions.
Here is ok, because we have to deal with a configuration file, but
I will definitively have to deal with other types of Lua scripts
that are not supposed to run over and over again. Am I right?
If I understood correctly what you are looking for, have a look at
the "Generic call function" in PiL2 (25.4).
Enrico
Unfortunately this is not what I'm looking for. All I want is a way to
evaluate an Lua expression (not calling a function). Something like
lua_evaluate_expression(L,"#applications")
where `applications` is a table of objects defined in the Lua file
loaded previously. As you can see is not a function. I'd like to have
a number
present on the Lua stack after returning from lua_evaluate_expression
function.
Another example of a more complex expression:
lua_evaluate_expression(L,"some_lua_function_that_returns_a_string()..
\" some other string\"")
where some_lua_function_that_returns_a_string is a Lua function that
returns a string. On the result we append `some other string` string
The expression evaluation would be made on the lua_State context, so
any expression can be made using all the things already present in the
Lua script.