lua-users home
lua-l archive

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

>How can I get the return value of the Lua chunk executed by lua_dostring
>from the C side, i.e. like getting the result returned by the Lua dostring

Just like the return values of any function.
Here is an example:

  lua_State *L=lua_open(0);
  lua_dostring(L,"return 1,'a'");

In general, you should take the k top values in the stack, where k is
the difference between lua_gettop(L) before calling lua_dostring and
lua_gettop(L) after calling it, that is, for indices from -1 to -k.