Use luaL_check/optinteger instead of luaL_check/optnumber when getting integer arguments to functions. Resolves issue #1251.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2017-07-16 12:17:50 -03:00
parent abcade9421
commit 34ebe18f14
30 changed files with 127 additions and 127 deletions
@@ -43,7 +43,7 @@ int w_CompressedImageData_clone(lua_State *L)
int w_CompressedImageData_getWidth(lua_State *L)
{
CompressedImageData *t = luax_checkcompressedimagedata(L, 1);
int miplevel = (int) luaL_optnumber(L, 2, 1);
int miplevel = (int) luaL_optinteger(L, 2, 1);
int width = 0;
luax_catchexcept(L, [&](){ width = t->getWidth(miplevel - 1); });
@@ -55,7 +55,7 @@ int w_CompressedImageData_getWidth(lua_State *L)
int w_CompressedImageData_getHeight(lua_State *L)
{
CompressedImageData *t = luax_checkcompressedimagedata(L, 1);
int miplevel = (int) luaL_optnumber(L, 2, 1);
int miplevel = (int) luaL_optinteger(L, 2, 1);
int height = 0;
luax_catchexcept(L, [&](){ height = t->getHeight(miplevel - 1); });
@@ -67,7 +67,7 @@ int w_CompressedImageData_getHeight(lua_State *L)
int w_CompressedImageData_getDimensions(lua_State *L)
{
CompressedImageData *t = luax_checkcompressedimagedata(L, 1);
int miplevel = (int) luaL_optnumber(L, 2, 1);
int miplevel = (int) luaL_optinteger(L, 2, 1);
int width = 0, height = 0;
luax_catchexcept(L, [&]()