Use luaL_check/optinteger instead of luaL_check/optnumber when getting integer arguments to functions. Resolves issue #1251.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2017-07-16 12:17:50 -03:00
parent abcade9421
commit 34ebe18f14
30 changed files with 127 additions and 127 deletions
+2 -2
View File
@@ -105,7 +105,7 @@ int Shape::rayCast(lua_State *L) const
float x = Physics::scaleDown((float)luaL_checknumber(L, 6));
float y = Physics::scaleDown((float)luaL_checknumber(L, 7));
float r = (float)luaL_checknumber(L, 8);
int childIndex = (int) luaL_optnumber(L, 9, 1) - 1; // Convert from 1-based index
int childIndex = (int) luaL_optinteger(L, 9, 1) - 1; // Convert from 1-based index
b2RayCastInput input;
input.p1.Set(p1x, p1y);
input.p2.Set(p2x, p2y);
@@ -125,7 +125,7 @@ int Shape::computeAABB(lua_State *L) const
float x = Physics::scaleDown((float)luaL_checknumber(L, 1));
float y = Physics::scaleDown((float)luaL_checknumber(L, 2));
float r = (float)luaL_checknumber(L, 3);
int childIndex = (int) luaL_optnumber(L, 4, 1) - 1; // Convert from 1-based index
int childIndex = (int) luaL_optinteger(L, 4, 1) - 1; // Convert from 1-based index
b2Transform transform(b2Vec2(x, y), b2Rot(r));
b2AABB box;
shape->ComputeAABB(&box, transform, childIndex);