mirror of
https://github.com/love2d/love.git
synced 2026-08-15 15:51:12 +02:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user