diff options
author | Loïc Blot <nerzhul@users.noreply.github.com> | 2018-06-04 22:38:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-04 22:38:07 +0200 |
commit | 180e551c56ec7229a15bfd9ce7339bc9881e1df6 (patch) | |
tree | 6425b85a713a8805ce42d5987cb8609c5aeb3d5b /src/script/lua_api/l_util.cpp | |
parent | 86b19f284990304f5c8322040f277138333a3697 (diff) | |
download | minetest-180e551c56ec7229a15bfd9ce7339bc9881e1df6.tar.gz minetest-180e551c56ec7229a15bfd9ce7339bc9881e1df6.tar.bz2 minetest-180e551c56ec7229a15bfd9ce7339bc9881e1df6.zip |
Modernize lua read (part 1): C++ templating insurance (#7394)
* Modernize lua read (part 1): C++ templating assurance
Implement the float reader
Diffstat (limited to 'src/script/lua_api/l_util.cpp')
-rw-r--r-- | src/script/lua_api/l_util.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/script/lua_api/l_util.cpp b/src/script/lua_api/l_util.cpp index c1b760941..b25697611 100644 --- a/src/script/lua_api/l_util.cpp +++ b/src/script/lua_api/l_util.cpp @@ -179,8 +179,7 @@ int ModApiUtil::l_get_hit_params(lua_State *L) if(lua_isnoneornil(L, 3)) push_hit_params(L, getHitParams(groups, &tp)); else - push_hit_params(L, getHitParams(groups, &tp, - luaL_checknumber(L, 3))); + push_hit_params(L, getHitParams(groups, &tp, readParam<float>(L, 3))); return 1; } @@ -270,7 +269,7 @@ int ModApiUtil::l_compress(lua_State *L) int level = -1; if (!lua_isnone(L, 3) && !lua_isnil(L, 3)) - level = luaL_checknumber(L, 3); + level = readParam<float>(L, 3); std::ostringstream os; compressZlib(std::string(data, size), os, level); |