Browse Source

Fix Source:setEffect working incorrectly when a fourth or more arguments are passed

--HG--
branch : PabloMayobre/fix-seteffecteffect-true-and-geteffectef-1540253791471
Pablo Mayobre 6 years ago
parent
commit
1670edf4ba
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/modules/audio/wrap_Source.cpp

+ 1 - 1
src/modules/audio/wrap_Source.cpp

@@ -464,7 +464,7 @@ int w_Source_setEffect(lua_State *L)
 	Source *t = luax_checksource(L, 1);
 	Source *t = luax_checksource(L, 1);
 	const char *namestr = luaL_checkstring(L, 2);
 	const char *namestr = luaL_checkstring(L, 2);
 
 
-	const bool isBool = lua_gettop(L) == 3 && lua_isboolean(L, 3);
+	const bool isBool = lua_gettop(L) >= 3 && lua_isboolean(L, 3);
 
 
 	// :setEffect(effect, false) = clear effect
 	// :setEffect(effect, false) = clear effect
 	if (isBool && !lua_toboolean(L, 3))
 	if (isBool && !lua_toboolean(L, 3))