Skip to content

Commit

Permalink
Lua->C getintfield() use lua_tointeger (#4408)
Browse files Browse the repository at this point in the history
previously function used tonumber which returned float
this caused errors in large numbers and resulted in
obj-def-handlers being invalid when retrived from lua tables in c
  • Loading branch information
tomasbrod authored and est31 committed Aug 10, 2016
1 parent 4503b50 commit c013c73
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/script/common/c_converter.cpp
Expand Up @@ -391,7 +391,7 @@ bool getintfield(lua_State *L, int table,
lua_getfield(L, table, fieldname);
bool got = false;
if(lua_isnumber(L, -1)){
result = lua_tonumber(L, -1);
result = lua_tointeger(L, -1);
got = true;
}
lua_pop(L, 1);
Expand All @@ -404,7 +404,7 @@ bool getintfield(lua_State *L, int table,
lua_getfield(L, table, fieldname);
bool got = false;
if(lua_isnumber(L, -1)){
result = lua_tonumber(L, -1);
result = lua_tointeger(L, -1);
got = true;
}
lua_pop(L, 1);
Expand All @@ -417,7 +417,7 @@ bool getintfield(lua_State *L, int table,
lua_getfield(L, table, fieldname);
bool got = false;
if(lua_isnumber(L, -1)){
result = lua_tonumber(L, -1);
result = lua_tointeger(L, -1);
got = true;
}
lua_pop(L, 1);
Expand All @@ -430,7 +430,7 @@ bool getintfield(lua_State *L, int table,
lua_getfield(L, table, fieldname);
bool got = false;
if(lua_isnumber(L, -1)){
result = lua_tonumber(L, -1);
result = lua_tointeger(L, -1);
got = true;
}
lua_pop(L, 1);
Expand Down

0 comments on commit c013c73

Please sign in to comment.