[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Help with mutliple return values
- From: RLake@...
- Date: Wed, 19 May 2004 14:56:11 -0400
> Perhaps I should mention that the function Test()
does get called and
> execute properly with the example code.
> If I put in a print( "hello" ), I see the result, just can't
seem to grab
> the return values.
I think Ashwin is right. Where did you put the print("hello")
?
print("hello")
function Test()
return "one", "two", "three"
end
-- or
function Test()
print("hello")
return "one", "two", "three"
end
by the way:
> lua_pushstring( spGlobalState, "loadstring"
); // function name
> lua_gettable( spGlobalState, LUA_GLOBALSINDEX ); // function
to be called
> lua_pushstring( spGlobalState, command.c_str() ); // parameter
can be much more easily accomplished, with correct
error checking:
if (0 != luaL_loadbuffer(L, command.c_str(), strlen(command.c_str()),
"command")) {
printf("Oops! : %s\n", lua_tostring(L,
-1));
exit(1);
} else {
// compiled chunk now on top of the stack
}
// I didn't use command.c_strlen() but perhaps you
have defined it :)