mirror of
https://github.com/love2d/love.git
synced 2026-08-15 15:51:12 +02:00
universal indexing rules in BezierCurve
This commit is contained in:
@@ -54,7 +54,8 @@ int w_BezierCurve_getControlPoint(lua_State *L)
|
||||
BezierCurve *curve = luax_checkbeziercurve(L, 1);
|
||||
int idx = luaL_checkinteger(L, 2);
|
||||
|
||||
idx--; // 1-indexing
|
||||
if (idx > 0) // 1-indexing
|
||||
idx--;
|
||||
|
||||
luax_catchexcept(L, [&]() {
|
||||
Vector v = curve->getControlPoint(idx);
|
||||
@@ -72,7 +73,8 @@ int w_BezierCurve_setControlPoint(lua_State *L)
|
||||
float vx = (float) luaL_checknumber(L, 3);
|
||||
float vy = (float) luaL_checknumber(L, 4);
|
||||
|
||||
idx--; // 1-indexing
|
||||
if (idx > 0) // 1-indexing
|
||||
idx--;
|
||||
|
||||
luax_catchexcept(L, [&](){ curve->setControlPoint(idx, Vector(vx,vy)); });
|
||||
return 0;
|
||||
@@ -97,7 +99,8 @@ int w_BezierCurve_removeControlPoint(lua_State *L)
|
||||
BezierCurve *curve = luax_checkbeziercurve(L, 1);
|
||||
int idx = luaL_checkint(L, 2);
|
||||
|
||||
idx--; // 1-indexing
|
||||
if (idx > 0) // 1-indexing
|
||||
idx--;
|
||||
|
||||
luax_catchexcept(L, [&](){ curve->removeControlPoint(idx); });
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user