1.
lua_pushfstring(L, "return %s", expr);
and
lua_remove(L,-2);
Are used only for appending `return ` in front of the expression, right?
2.
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--
lua_evaluate_expression(L,"#applications");
...
lua_evaluate_expression(L,"applications[1].database.name");
...
--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
beginning)
return #applications --this was added by the first call of
lua_evaluate_expression
return applications[1].database.name --this was added by the second
call
--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?