don't allow invalid types for the second param of readbackTexture.

This commit is contained in:
Sasha Szpakowski
2026-03-31 20:38:52 -03:00
parent 4d25b8c97a
commit 0e0a7d2155
+4
View File
@@ -2395,6 +2395,8 @@ int w_readbackTexture(lua_State *L)
int slice = 0;
if (t->getTextureType() != TEXTURE_2D)
slice = (int) luaL_checkinteger(L, 2) - 1;
else if (!lua_isnoneornil(L, 2) && lua_type(L, 2) != LUA_TNUMBER)
luaL_argerror(L, 2, "number or nil expected");
int mipmap = (int) luaL_optinteger(L, 3, 1) - 1;
@@ -2433,6 +2435,8 @@ int w_readbackTextureAsync(lua_State *L)
int slice = 0;
if (t->getTextureType() != TEXTURE_2D)
slice = (int) luaL_checkinteger(L, 2) - 1;
else if (!lua_isnoneornil(L, 2) && lua_type(L, 2) != LUA_TNUMBER)
luaL_argerror(L, 2, "number or nil expected");
int mipmap = (int) luaL_optinteger(L, 3, 1) - 1;