diff options
author | Tomas <tomasbrod@azet.sk> | 2016-08-10 12:17:48 +0200 |
---|---|---|
committer | est31 <est31@users.noreply.github.com> | 2016-08-10 12:17:48 +0200 |
commit | c013c73f338b1c2227662458ebc650883f83271c (patch) | |
tree | 14d65d406324dce95de99e2af932a643f2f59033 /src/script | |
parent | 4503b5097f99d2806763650f33d8ef3b49f77ce4 (diff) | |
download | minetest-c013c73f338b1c2227662458ebc650883f83271c.tar.gz minetest-c013c73f338b1c2227662458ebc650883f83271c.tar.bz2 minetest-c013c73f338b1c2227662458ebc650883f83271c.zip |
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
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/common/c_converter.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/script/common/c_converter.cpp b/src/script/common/c_converter.cpp index 55c4a5f5a..857300fa5 100644 --- a/src/script/common/c_converter.cpp +++ b/src/script/common/c_converter.cpp @@ -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); @@ -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); @@ -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); @@ -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); |