more lua_pushinteger conversion for lua 5.3

This commit is contained in:
Enno Rehling 2015-06-08 21:19:17 +02:00
parent 84f8a9f746
commit 4e33e59d64
4 changed files with 11 additions and 11 deletions

View File

@ -47,7 +47,7 @@ static int tolua_dict_get(lua_State * L)
lua_pushnil(L); lua_pushnil(L);
break; break;
case TINTEGER: case TINTEGER:
lua_pushnumber(L, (lua_Number)val.i); lua_pushinteger(L, val.i);
break; break;
case TREAL: case TREAL:
lua_pushnumber(L, (lua_Number)val.f); lua_pushnumber(L, (lua_Number)val.f);

View File

@ -77,7 +77,7 @@ int tolua_faction_add_item(lua_State * L)
result = i ? i->number : 0; result = i ? i->number : 0;
} /* if (itype!=NULL) */ } /* if (itype!=NULL) */
} }
lua_pushnumber(L, result); lua_pushinteger(L, result);
return 1; return 1;
} }

View File

@ -524,7 +524,7 @@ static int tolua_region_get_age(lua_State * L)
region *self = (region *)tolua_tousertype(L, 1, 0); region *self = (region *)tolua_tousertype(L, 1, 0);
if (self) { if (self) {
lua_pushnumber(L, self->age); lua_pushinteger(L, self->age);
return 1; return 1;
} }
return 0; return 0;
@ -638,8 +638,8 @@ static int tolua_plane_tostring(lua_State * L)
static int tolua_plane_get_size(lua_State * L) static int tolua_plane_get_size(lua_State * L)
{ {
plane *pl = (plane *)tolua_tousertype(L, 1, 0); plane *pl = (plane *)tolua_tousertype(L, 1, 0);
lua_pushnumber(L, plane_width(pl)); lua_pushinteger(L, plane_width(pl));
lua_pushnumber(L, plane_height(pl)); lua_pushinteger(L, plane_height(pl));
return 2; return 2;
} }
@ -657,7 +657,7 @@ static int tolua_distance(lua_State * L)
pnormalize(&x1, &y1, pl); pnormalize(&x1, &y1, pl);
pnormalize(&x2, &y2, pl); pnormalize(&x2, &y2, pl);
result = koor_distance(x1, y1, x2, y2); result = koor_distance(x1, y1, x2, y2);
lua_pushnumber(L, result); lua_pushinteger(L, result);
return 1; return 1;
} }

View File

@ -139,7 +139,7 @@ int tolua_quicklist_push(struct lua_State *L, const char *list_type,
*qlist_ptr = list; *qlist_ptr = list;
luaL_getmetatable(L, list_type); luaL_getmetatable(L, list_type);
lua_setmetatable(L, -2); lua_setmetatable(L, -2);
lua_pushnumber(L, 0); lua_pushinteger(L, 0);
lua_pushstring(L, elem_type); lua_pushstring(L, elem_type);
lua_pushcclosure(L, tolua_quicklist_iter, 3); /* OBS: this closure has multiple upvalues (list, index, type_name) */ lua_pushcclosure(L, tolua_quicklist_iter, 3); /* OBS: this closure has multiple upvalues (list, index, type_name) */
} }
@ -219,7 +219,7 @@ static int tolua_setkey(lua_State * L)
static int tolua_rng_int(lua_State * L) static int tolua_rng_int(lua_State * L)
{ {
lua_pushnumber(L, (lua_Number)rng_int()); lua_pushinteger(L, rng_int());
return 1; return 1;
} }
@ -227,7 +227,7 @@ static int tolua_read_orders(lua_State * L)
{ {
const char *filename = tolua_tostring(L, 1, 0); const char *filename = tolua_tostring(L, 1, 0);
int result = readorders(filename); int result = readorders(filename);
lua_pushnumber(L, (lua_Number)result); lua_pushinteger(L, result);
return 1; return 1;
} }
@ -534,7 +534,7 @@ static int tolua_process_orders(lua_State * L)
static int tolua_write_passwords(lua_State * L) static int tolua_write_passwords(lua_State * L)
{ {
int result = writepasswd(); int result = writepasswd();
lua_pushnumber(L, (lua_Number)result); lua_pushinteger(L, result);
return 0; return 0;
} }
@ -982,7 +982,7 @@ static int tolua_get_spell_school(lua_State * L)
static int tolua_get_spell_level(lua_State * L) static int tolua_get_spell_level(lua_State * L)
{ {
spell *self = (spell *) tolua_tousertype(L, 1, 0); spell *self = (spell *) tolua_tousertype(L, 1, 0);
lua_pushnumber(L, self->level); lua_pushinteger(L, self->level);
return 1; return 1;
} }
#endif #endif