[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Newbie question about return values
- From: Hartmut Seichter <hartmut@...>
- Date: Mon, 09 Jun 2003 12:58:08 GMT
Hi,
after reading through several docs and samples and try and error I want to bother you with
the following problem (Lua version 5.0).
Lets say I want to do following:
vec = tpVec3f()
vec:set(100,100,100)
local x,y,z
-- trouble starts here
vec:get(x,y,z)
io.write(x)
-- I get nil value
the vector c'tor set works fine. I can script my objects nicely.
But I want to get x,y,z at once:
so my C++ (Luna method) reads like this:
int tpLuaVec3f::get(lua_State* L)
{
lua_pushnumber(L,vec[0]);
lua_pushnumber(L,vec[1]);
lua_pushnumber(L,vec[2]);
return 0; // return 3; does also produce the same nil value
};
// somewhere inherited from parent class
float vec[3];
Is it possible to get all three vector components at once or do I need to access them
separatly or via tables? Is it possible to write to the values of a function(x,y,z)
Any hints highly appreciated.
Regards,
Hartmut