1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Fix isNan on setYaw Lua call (#7380)

* Fix isNan on setYaw Lua call
This commit is contained in:
Loïc Blot 2018-05-31 22:52:08 +02:00 committed by GitHub
parent df991edaa8
commit 162ffd7fba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 30 additions and 1 deletions

View file

@ -895,6 +895,9 @@ int ObjectRef::l_set_yaw(lua_State *L)
ObjectRef *ref = checkobject(L, 1);
LuaEntitySAO *co = getluaobject(ref);
if (co == NULL) return 0;
if (isNaN(L, 2))
throw LuaError("ObjectRef::set_yaw: NaN value is not allowed.");
float yaw = luaL_checknumber(L, 2) * core::RADTODEG;
// Do it
co->setYaw(yaw);