Bart van Strien avatar 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))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.