lua-users home
lua-l archive

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



	...
    int start_index = lua_gettop( spGlobalState );


    lua_pushstring( spGlobalState, "loadstring" );      // function name
    lua_gettable( spGlobalState, LUA_GLOBALSINDEX );    // function to be
called
    lua_pushstring( spGlobalState, command.c_str() );   // parameter
    lua_call( spGlobalState, 1, 1 );                    // call function
with 1 arguments and 1 result
    lua_call( spGlobalState, 0, LUA_MULTRET );          // call function
with 0 arguments and variable results

    int end_index = lua_gettop( spGlobalState );
	...

I'm expecting end_index - start_index to be 3 since Test() returns 3 values,
but it's allways zero.

I'm sure I'm missing something simple...

After the first lua_call() the function and parameter you pushed are popped off the stack. How can the second lua_call() actually succeed? Did you check the return value?

Ashwin.
--
no signature is a signature