int w_Body_applyForce(lua_State *L) { Body *t = luax_checkbody(L, 1); float fx = (float)luaL_checknumber(L, 2); float fy = (float)luaL_checknumber(L, 3); int nargs = lua_gettop(L); if (nargs <= 3 || (nargs == 4 && lua_type(L, 4) == LUA_TBOOLEAN)) { bool awake = luax_optboolean(L, 4, true); t->applyForce(fx, fy, awake); } else if (lua_gettop(L) >= 5) { float rx = (float)luaL_checknumber(L, 4); float ry = (float)luaL_checknumber(L, 5); bool awake = luax_optboolean(L, 6, true); t->applyForce(fx, fy, rx, ry, awake); } else { return luaL_error(L, "Wrong number of parameters."); } return 0; }
int w_Body_applyForce(lua_State * L) { Body * t = luax_checkbody(L, 1); float fx = (float)luaL_checknumber(L, 2); float fy = (float)luaL_checknumber(L, 3); if(lua_gettop(L) == 3) { t->applyForce(fx, fy); } else if(lua_gettop(L) == 5) { float rx = (float)luaL_checknumber(L, 4); float ry = (float)luaL_checknumber(L, 5); t->applyForce(fx, fy, rx, ry); } else { return luaL_error(L, "Wrong number of parameters."); } return 0; }