Browse Source

Fixed love.graphics.setScissor and love.graphics.setColorMask to not error if a single nil argument is given (resolves issue #709)

Alex Szpakowski 12 years ago
parent
commit
394888bd13
1 changed files with 3 additions and 3 deletions
  1. 3 3
      src/modules/graphics/opengl/wrap_Graphics.cpp

+ 3 - 3
src/modules/graphics/opengl/wrap_Graphics.cpp

@@ -83,7 +83,7 @@ int w_getDimensions(lua_State *L)
 
 
 int w_setScissor(lua_State *L)
 int w_setScissor(lua_State *L)
 {
 {
-	if (lua_gettop(L) == 0)
+	if (lua_gettop(L) <= 1 && lua_isnoneornil(L, 1))
 	{
 	{
 		instance->setScissor();
 		instance->setScissor();
 		return 0;
 		return 0;
@@ -688,7 +688,7 @@ int w_setColorMask(lua_State *L)
 {
 {
 	bool mask[4];
 	bool mask[4];
 
 
-	if (lua_gettop(L) == 0)
+	if (lua_gettop(L) <= 1 && lua_isnoneornil(L, 1))
 	{
 	{
 		// Enable all color components if no argument is given.
 		// Enable all color components if no argument is given.
 		mask[0] = mask[1] = mask[2] = mask[3] = true;
 		mask[0] = mask[1] = mask[2] = mask[3] = true;
@@ -848,7 +848,7 @@ int w_setLineJoin(lua_State *L)
 	Graphics::LineJoin join;
 	Graphics::LineJoin join;
 	const char *str = luaL_checkstring(L, 1);
 	const char *str = luaL_checkstring(L, 1);
 	if (!Graphics::getConstant(str, join))
 	if (!Graphics::getConstant(str, join))
-		return luaL_error(L, "Invalid line join: %s", str);
+		return luaL_error(L, "Invalid line join mode: %s", str);
 
 
 	instance->setLineJoin(join);
 	instance->setLineJoin(join);
 	return 0;
 	return 0;