forked from Mirrorlandia_minetest/minetest
Lua->C getintfield() use lua_tointeger (#4408)
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
This commit is contained in:
parent
4503b5097f
commit
c013c73f33
@ -391,7 +391,7 @@ bool getintfield(lua_State *L, int table,
|
|||||||
lua_getfield(L, table, fieldname);
|
lua_getfield(L, table, fieldname);
|
||||||
bool got = false;
|
bool got = false;
|
||||||
if(lua_isnumber(L, -1)){
|
if(lua_isnumber(L, -1)){
|
||||||
result = lua_tonumber(L, -1);
|
result = lua_tointeger(L, -1);
|
||||||
got = true;
|
got = true;
|
||||||
}
|
}
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
@ -404,7 +404,7 @@ bool getintfield(lua_State *L, int table,
|
|||||||
lua_getfield(L, table, fieldname);
|
lua_getfield(L, table, fieldname);
|
||||||
bool got = false;
|
bool got = false;
|
||||||
if(lua_isnumber(L, -1)){
|
if(lua_isnumber(L, -1)){
|
||||||
result = lua_tonumber(L, -1);
|
result = lua_tointeger(L, -1);
|
||||||
got = true;
|
got = true;
|
||||||
}
|
}
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
@ -417,7 +417,7 @@ bool getintfield(lua_State *L, int table,
|
|||||||
lua_getfield(L, table, fieldname);
|
lua_getfield(L, table, fieldname);
|
||||||
bool got = false;
|
bool got = false;
|
||||||
if(lua_isnumber(L, -1)){
|
if(lua_isnumber(L, -1)){
|
||||||
result = lua_tonumber(L, -1);
|
result = lua_tointeger(L, -1);
|
||||||
got = true;
|
got = true;
|
||||||
}
|
}
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
@ -430,7 +430,7 @@ bool getintfield(lua_State *L, int table,
|
|||||||
lua_getfield(L, table, fieldname);
|
lua_getfield(L, table, fieldname);
|
||||||
bool got = false;
|
bool got = false;
|
||||||
if(lua_isnumber(L, -1)){
|
if(lua_isnumber(L, -1)){
|
||||||
result = lua_tonumber(L, -1);
|
result = lua_tointeger(L, -1);
|
||||||
got = true;
|
got = true;
|
||||||
}
|
}
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user