int w_ChainShape_getVertexCount(lua_State *L) { ChainShape *c = luax_checkchainshape(L, 1); int count = c->getVertexCount(); lua_pushinteger(L, count); return 1; }
int w_ChainShape_getPoints(lua_State *L) { ChainShape *c = luax_checkchainshape(L, 1); const b2Vec2 *verts = c->getPoints(); int count = c->getVertexCount(); if (!lua_checkstack(L, count*2)) return luaL_error(L, "Too many return values"); for (int i = 0; i < count; i++) { b2Vec2 v = Physics::scaleUp(verts[i]); lua_pushnumber(L, v.x); lua_pushnumber(L, v.y); } return count*2; }