summaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_env.cpp
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2018-06-04 22:38:07 +0200
committerGitHub <noreply@github.com>2018-06-04 22:38:07 +0200
commit180e551c56ec7229a15bfd9ce7339bc9881e1df6 (patch)
tree6425b85a713a8805ce42d5987cb8609c5aeb3d5b /src/script/lua_api/l_env.cpp
parent86b19f284990304f5c8322040f277138333a3697 (diff)
downloadminetest-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_env.cpp')
-rw-r--r--src/script/lua_api/l_env.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/script/lua_api/l_env.cpp b/src/script/lua_api/l_env.cpp
index 6d45d6c49..2eb7f3395 100644
--- a/src/script/lua_api/l_env.cpp
+++ b/src/script/lua_api/l_env.cpp
@@ -666,7 +666,7 @@ int ModApiEnvMod::l_get_objects_inside_radius(lua_State *L)
// Do it
v3f pos = checkFloatPos(L, 1);
- float radius = luaL_checknumber(L, 2) * BS;
+ float radius = readParam<float>(L, 2) * BS;
std::vector<u16> ids;
env->getObjectsInsideRadius(ids, pos, radius);
ScriptApiBase *script = getScriptApiBase(L);
@@ -690,7 +690,7 @@ int ModApiEnvMod::l_set_timeofday(lua_State *L)
GET_ENV_PTR;
// Do it
- float timeofday_f = luaL_checknumber(L, 1);
+ float timeofday_f = readParam<float>(L, 1);
sanity_check(timeofday_f >= 0.0 && timeofday_f <= 1.0);
int timeofday_mh = (int)(timeofday_f * 24000.0);
// This should be set directly in the environment but currently
@@ -925,8 +925,8 @@ int ModApiEnvMod::l_get_perlin(lua_State *L)
} else {
params.seed = luaL_checkint(L, 1);
params.octaves = luaL_checkint(L, 2);
- params.persist = luaL_checknumber(L, 3);
- params.spread = v3f(1, 1, 1) * luaL_checknumber(L, 4);
+ params.persist = readParam<float>(L, 3);
+ params.spread = v3f(1, 1, 1) * readParam<float>(L, 4);
}
params.seed += (int)env->getServerMap().getSeed();