[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Eval a Lua expression
- From: Shmuel Zeigerman <shmuz@...>
- Date: Thu, 03 Apr 2008 00:29:47 +0300
Eugen-Andrei Gavriloaie wrote:
lua_pushfstring(L, "return %s", expr);
Are used only for appending `return ` in front of the expression, right?
The lua_State *L will be reused (I need to read many things), so the end
result script from memory will look like this after this sequence of
calls from c++
--begin C++ code--
--end C++ code--
--begin lua script represented from lua_State *L point of view --
... (original code from the file that was loaded from the very
return #applications --this was added by the first call of
return applications.database.name --this was added by the second
--end lua script represented from lua_State *L point of view --
So, on the second lua_evaluate_expression call from C++ I will have a
value of 2 instead of the string 'mysql' pushed on the stack because the
entire script execution stops at the first return. Am I right?
3. I think the entire script will be executed entirely on each
lua_evaluate_expression because of lua_pcall(L,0,1,0).