summaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_base.cpp
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2018-05-31 22:52:08 +0200
committerGitHub <noreply@github.com>2018-05-31 22:52:08 +0200
commit162ffd7fba9d4e79a29f65686f3efbebaee9cee8 (patch)
treed58d2329f223eb991b4c39c7cfce209c46edc284 /src/script/lua_api/l_base.cpp
parentdf991edaa8617730f4ad15648e9131325a0fe2e8 (diff)
downloadminetest-162ffd7fba9d4e79a29f65686f3efbebaee9cee8.tar.gz
minetest-162ffd7fba9d4e79a29f65686f3efbebaee9cee8.tar.bz2
minetest-162ffd7fba9d4e79a29f65686f3efbebaee9cee8.zip
Fix isNan on setYaw Lua call (#7380)
* Fix isNan on setYaw Lua call
Diffstat (limited to 'src/script/lua_api/l_base.cpp')
-rw-r--r--src/script/lua_api/l_base.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/script/lua_api/l_base.cpp b/src/script/lua_api/l_base.cpp
index 8ab0a20b6..e62aa2368 100644
--- a/src/script/lua_api/l_base.cpp
+++ b/src/script/lua_api/l_base.cpp
@@ -21,7 +21,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "lua_api/l_internal.h"
#include "cpp_api/s_base.h"
#include "content/mods.h"
-#include <server.h>
+#include "server.h"
+#include <cmath>
ScriptApiBase *ModApiBase::getScriptApiBase(lua_State *L)
{
@@ -84,3 +85,8 @@ bool ModApiBase::registerFunction(lua_State *L, const char *name,
return true;
}
+
+bool ModApiBase::isNaN(lua_State *L, int idx)
+{
+ return lua_type(L, idx) == LUA_TNUMBER && std::isnan(lua_tonumber(L, idx));
+}