lua-users home
lua-l archive

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


ok this is what i want to do,
i've got a vector3 class similar to the vector3 tutorial in the example but using metatables of cause..
and what im trying to do is the __add for it, but im not sure what to return, or push onto the stack i should say.
 
heres what im doing in c atm..
 

int vec3add(lua_State *L) {

vector3* v=(vector3*)lua_touserdata(L,1);

vector3* v2=(vector3*)lua_touserdata(L,2);

*v+=*v2;

lua_pushlightuserdata(L, v);

return 1;

}

and in lua its just something like a=a+b;

anyway.. nothing happens. but this is all i could think of, does anyone have any ideas on what i should do or what im doing wrong.