lua-users home
lua-l archive

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


Hello,

I'm using two different Lua states and I would like to copy a return argument of a Lua script function via C API into the other state eg:

--Lua script 1--

function test()
    return {1,2,3}
end

--Lua script 2--
   function test2( ... )
   end

On the first function the return argument can be changed, like return "test".
I would like to read the stack in C without any converting into C types:

lua_pcall( state1, ....)

std::vector<lua_types> l_data;
l_data.push_back( <put stack values from stat1>   );

push_to_stack( state2, l_data.last() );
lua_pcall( state2, ...)


I would get all return arguments in one structure independed of their types and push
them into another state

Can I read the return arguments into one memory block eg?

Thanks

Phil