فهرست منبع

love.graphics.draw(image, quad, x, y, ...) now errors instead of shifting parameters if the quad argument is nil

Alex Szpakowski 12 سال پیش
والد
کامیت
b556dde3cb
2فایلهای تغییر یافته به همراه8 افزوده شده و 0 حذف شده
  1. 4 0
      src/modules/graphics/opengl/wrap_Graphics.cpp
  2. 4 0
      src/modules/graphics/opengl/wrap_SpriteBatch.cpp

+ 4 - 0
src/modules/graphics/opengl/wrap_Graphics.cpp

@@ -1017,6 +1017,10 @@ int w_draw(lua_State *L)
 		quad = luax_totype<Quad>(L, 2, "Quad", GRAPHICS_QUAD_T);
 		quad = luax_totype<Quad>(L, 2, "Quad", GRAPHICS_QUAD_T);
 		startidx = 3;
 		startidx = 3;
 	}
 	}
+	else if (lua_isnil(L, 2) && !lua_isnoneornil(L, 3))
+	{
+		return luax_typerror(L, 2, "Quad");
+	}
 	else
 	else
 	{
 	{
 		drawable = luax_checktype<Drawable>(L, 1, "Drawable", GRAPHICS_DRAWABLE_T);
 		drawable = luax_checktype<Drawable>(L, 1, "Drawable", GRAPHICS_DRAWABLE_T);

+ 4 - 0
src/modules/graphics/opengl/wrap_SpriteBatch.cpp

@@ -44,6 +44,8 @@ int w_SpriteBatch_add(lua_State *L)
 		quad = luax_totype<Quad>(L, 2, "Quad", GRAPHICS_QUAD_T);
 		quad = luax_totype<Quad>(L, 2, "Quad", GRAPHICS_QUAD_T);
 		startidx = 3;
 		startidx = 3;
 	}
 	}
+	else if (lua_isnil(L, 2) && !lua_isnoneornil(L, 3))
+		return luax_typerror(L, 2, "Quad");
 
 
 	float x  = (float) luaL_optnumber(L, startidx + 0, 0.0);
 	float x  = (float) luaL_optnumber(L, startidx + 0, 0.0);
 	float y  = (float) luaL_optnumber(L, startidx + 1, 0.0);
 	float y  = (float) luaL_optnumber(L, startidx + 1, 0.0);
@@ -80,6 +82,8 @@ int w_SpriteBatch_set(lua_State *L)
 		quad = luax_totype<Quad>(L, 3, "Quad", GRAPHICS_QUAD_T);
 		quad = luax_totype<Quad>(L, 3, "Quad", GRAPHICS_QUAD_T);
 		startidx = 4;
 		startidx = 4;
 	}
 	}
+	else if (lua_isnil(L, 3) && !lua_isnoneornil(L, 4))
+		return luax_typerror(L, 3, "Quad");
 
 
 	float x  = (float) luaL_optnumber(L, startidx + 0, 0.0);
 	float x  = (float) luaL_optnumber(L, startidx + 0, 0.0);
 	float y  = (float) luaL_optnumber(L, startidx + 1, 0.0);
 	float y  = (float) luaL_optnumber(L, startidx + 1, 0.0);