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
@@ -280,7 +280,7 @@ int Fixture::rayCast(lua_State *L) const
float p2x = Physics::scaleDown((float)luaL_checknumber(L, 3));
float p2y = Physics::scaleDown((float)luaL_checknumber(L, 4));
float maxFraction = (float)luaL_checknumber(L, 5);
int childIndex = (int) luaL_optnumber(L, 6, 1) - 1; // Convert from 1-based index
int childIndex = (int) luaL_optinteger(L, 6, 1) - 1; // Convert from 1-based index
b2RayCastInput input;
input.p1.Set(p1x, p1y);
input.p2.Set(p2x, p2y);
@@ -296,7 +296,7 @@ int Fixture::rayCast(lua_State *L) const
int Fixture::getBoundingBox(lua_State *L) const
{
int childIndex = (int) luaL_optnumber(L, 1, 1) - 1; // Convert from 1-based index
int childIndex = (int) luaL_optinteger(L, 1, 1) - 1; // Convert from 1-based index
b2AABB box;
luax_catchexcept(L, [&]() { box = fixture->GetAABB(childIndex); });
box = Physics::scaleUp(box);