[lua] Minor changes

This commit is contained in:
David Capello 2020-07-28 17:40:43 -03:00
parent c4ed8c1450
commit 11324c207d
3 changed files with 3 additions and 6 deletions

View File

@ -30,8 +30,7 @@ gfx::Point Point_new(lua_State* L, int index)
// Convert {x=int,y=int} or {int,int} into a Point
else if (lua_istable(L, index)) {
const int type = lua_getfield(L, index, "x");
if (type != LUA_TNONE &&
type != LUA_TNIL) {
if (VALID_LUATYPE(type)) {
lua_getfield(L, index, "y");
pt.x = lua_tointeger(L, -2);
pt.y = lua_tointeger(L, -1);

View File

@ -29,8 +29,7 @@ gfx::Rect Rectangle_new(lua_State* L, int index)
// Convert { x, y, width, height } into a Rectangle
else if (lua_istable(L, index)) {
const int type = lua_getfield(L, index, "x");
if (type != LUA_TNONE &&
type != LUA_TNIL) {
if (VALID_LUATYPE(type)) {
lua_getfield(L, index, "y");
lua_getfield(L, index, "width");
lua_getfield(L, index, "height");

View File

@ -30,8 +30,7 @@ gfx::Size Size_new(lua_State* L, int index)
// Convert {x=int,y=int} or {int,int} into a Size
else if (lua_istable(L, index)) {
const int type = lua_getfield(L, index, "width");
if (type != LUA_TNONE &&
type != LUA_TNIL) {
if (VALID_LUATYPE(type)) {
lua_getfield(L, index, "height");
sz.w = lua_tointeger(L, -2);
sz.h = lua_tointeger(L, -1);