diff --git a/src/modules/graphics/opengl/wrap_Graphics.cpp b/src/modules/graphics/opengl/wrap_Graphics.cpp index 2f227df44..e9b149b7a 100644 --- a/src/modules/graphics/opengl/wrap_Graphics.cpp +++ b/src/modules/graphics/opengl/wrap_Graphics.cpp @@ -632,8 +632,17 @@ int w_getFont(lua_State *L) int w_setColorMask(lua_State *L) { bool mask[4]; - for (int i = 0; i < 4; i++) - mask[i] = luax_toboolean(L, i + 1); + + if (lua_gettop(L) == 0) + { + // Enable all color components if no argument is given. + mask[0] = mask[1] = mask[2] = mask[3] = true; + } + else + { + for (int i = 0; i < 4; i++) + mask[i] = luax_toboolean(L, i + 1); + } // r, g, b, a instance->setColorMask(mask[0], mask[1], mask[2], mask[3]);