Commits

Bart van Strien committed a54920f

Make second argument to setDefaultImageFilter Image:setFilter and Image:setWrap optional, and default to the first

Comments (0)

Files changed (2)

src/modules/graphics/opengl/wrap_Graphics.cpp

 	Image::FilterMode min;
 	Image::FilterMode mag;
 	const char *minstr = luaL_checkstring(L, 1);
-	const char *magstr = luaL_checkstring(L, 2);
+	const char *magstr = luaL_optstring(L, 2, minstr);
 	if (!Image::getConstant(minstr, min))
 		return luaL_error(L, "Invalid filter mode: %s", minstr);
 	if (!Image::getConstant(magstr, mag))

src/modules/graphics/opengl/wrap_Image.cpp

 	Image::FilterMode min;
 	Image::FilterMode mag;
 	const char *minstr = luaL_checkstring(L, 2);
-	const char *magstr = luaL_checkstring(L, 3);
+	const char *magstr = luaL_optstring(L, 3, minstr);
 	if (!Image::getConstant(minstr, min))
 		return luaL_error(L, "Invalid filter mode: %s", minstr);
 	if (!Image::getConstant(magstr, mag))
 	Image::WrapMode s;
 	Image::WrapMode t;
 	const char *sstr = luaL_checkstring(L, 2);
-	const char *tstr = luaL_checkstring(L, 3);
+	const char *tstr = luaL_optstring(L, 3, sstr);
 	if (!Image::getConstant(sstr, s))
 		return luaL_error(L, "Invalid wrap mode: %s", sstr);
 	if (!Image::getConstant(tstr, t))