Browse Source

Allow calling newRasterizer without arguments from newFont again

Fixes regression introduced by commit 9b0752574f26, the default value for the
1-argument newFont could not be called.
Thanks to josefnpat for reporting.
Bart van Strien 10 years ago
parent
commit
600a369d77
1 changed files with 4 additions and 1 deletions
  1. 4 1
      src/modules/graphics/opengl/wrap_Graphics.cpp

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

@@ -249,8 +249,11 @@ int w_newFont(lua_State *L)
 	// Convert to Rasterizer, if necessary. Note that lua_isstring returns true
 	// Convert to Rasterizer, if necessary. Note that lua_isstring returns true
 	// if the value is a number, which we rely on for the variant that uses the
 	// if the value is a number, which we rely on for the variant that uses the
 	// default Font rather than a font file.
 	// default Font rather than a font file.
-	if (lua_isstring(L, 1) || luax_istype(L, 1, FILESYSTEM_FILE_T) || luax_istype(L, 1, FILESYSTEM_FILE_DATA_T))
+	if (lua_isnoneornil(L, 1) || lua_isstring(L, 1) || luax_istype(L, 1, FILESYSTEM_FILE_T) || luax_istype(L, 1, FILESYSTEM_FILE_DATA_T))
 	{
 	{
+		if (lua_isnone(L, 1))
+			lua_pushnil(L);
+
 		std::vector<int> idxs;
 		std::vector<int> idxs;
 		for (int i = 0; i < lua_gettop(L); i++)
 		for (int i = 0; i < lua_gettop(L); i++)
 			idxs.push_back(i + 1);
 			idxs.push_back(i + 1);