From dc8f29206201fcc977443ce9c6138c2f3129c1c8 Mon Sep 17 00:00:00 2001 From: sanine Date: Wed, 22 Mar 2023 23:06:26 -0500 Subject: re-implement bouncing ball --- src/ode/body.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/ode/body.c') diff --git a/src/ode/body.c b/src/ode/body.c index f543b34..1284bb0 100644 --- a/src/ode/body.c +++ b/src/ode/body.c @@ -19,9 +19,11 @@ void ode_push_body(lua_State *L, dBodyID bb) { struct body_t *b = lua_newuserdata(L, sizeof(struct body_t)); b->id = bb; - b->data.L = L; - b->data.callback_ref = LUA_NOREF; - dBodySetData(b->id, &(b->data)); + if (bb != 0) { + b->data.L = L; + b->data.callback_ref = LUA_NOREF; + dBodySetData(b->id, &(b->data)); + } luaL_getmetatable(L, ode_body_tname); lua_setmetatable(L, -2); } @@ -140,7 +142,8 @@ int dBodyGetQuaternion_bind(lua_State *L) lua_pushnumber(L, bind_result[0]); lua_pushnumber(L, bind_result[1]); lua_pushnumber(L, bind_result[2]); - return 3; + lua_pushnumber(L, bind_result[3]); + return 4; } -- cgit v1.2.1