mirror of
https://github.com/love2d/love.git
synced 2026-08-14 01:20:56 +02:00
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:
@@ -158,8 +158,8 @@ static pushpixel pushFormats[PIXELFORMAT_MAX_ENUM] = {};
|
||||
int w_ImageData_getPixel(lua_State *L)
|
||||
{
|
||||
ImageData *t = luax_checkimagedata(L, 1);
|
||||
int x = (int) luaL_checknumber(L, 2);
|
||||
int y = (int) luaL_checknumber(L, 3);
|
||||
int x = (int) luaL_checkinteger(L, 2);
|
||||
int y = (int) luaL_checkinteger(L, 3);
|
||||
|
||||
PixelFormat format = t->getFormat();
|
||||
|
||||
@@ -172,8 +172,8 @@ int w_ImageData_getPixel(lua_State *L)
|
||||
int w_ImageData_setPixel(lua_State *L)
|
||||
{
|
||||
ImageData *t = luax_checkimagedata(L, 1);
|
||||
int x = (int) luaL_checknumber(L, 2);
|
||||
int y = (int) luaL_checknumber(L, 3);
|
||||
int x = (int) luaL_checkinteger(L, 2);
|
||||
int y = (int) luaL_checkinteger(L, 3);
|
||||
|
||||
PixelFormat format = t->getFormat();
|
||||
|
||||
@@ -247,12 +247,12 @@ int w_ImageData_paste(lua_State *L)
|
||||
{
|
||||
ImageData *t = luax_checkimagedata(L, 1);
|
||||
ImageData *src = luax_checkimagedata(L, 2);
|
||||
int dx = (int) luaL_checknumber(L, 3);
|
||||
int dy = (int) luaL_checknumber(L, 4);
|
||||
int sx = (int) luaL_optnumber(L, 5, 0);
|
||||
int sy = (int) luaL_optnumber(L, 6, 0);
|
||||
int sw = (int) luaL_optnumber(L, 7, src->getWidth());
|
||||
int sh = (int) luaL_optnumber(L, 8, src->getHeight());
|
||||
int dx = (int) luaL_checkinteger(L, 3);
|
||||
int dy = (int) luaL_checkinteger(L, 4);
|
||||
int sx = (int) luaL_optinteger(L, 5, 0);
|
||||
int sy = (int) luaL_optinteger(L, 6, 0);
|
||||
int sw = (int) luaL_optinteger(L, 7, src->getWidth());
|
||||
int sh = (int) luaL_optinteger(L, 8, src->getHeight());
|
||||
t->paste((love::image::ImageData *)src, dx, dy, sx, sy, sw, sh);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user