Fix float argument check in minetest.set_timeofday() (#10483)

Co-authored-by: Zughy <4279489-marco_a@users.noreply.gitlab.com>
This commit is contained in:
Zughy 2020-10-13 21:28:53 +02:00 committed by GitHub
parent 2ca81d679f
commit 7499ebe46a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -751,8 +751,9 @@ int ModApiEnvMod::l_set_timeofday(lua_State *L)
// Do it // Do it
float timeofday_f = readParam<float>(L, 1); float timeofday_f = readParam<float>(L, 1);
sanity_check(timeofday_f >= 0.0 && timeofday_f <= 1.0); luaL_argcheck(L, timeofday_f >= 0.0f && timeofday_f <= 1.0f, 1,
int timeofday_mh = (int)(timeofday_f * 24000.0); "value must be between 0 and 1");
int timeofday_mh = (int)(timeofday_f * 24000.0f);
// This should be set directly in the environment but currently // This should be set directly in the environment but currently
// such changes aren't immediately sent to the clients, so call // such changes aren't immediately sent to the clients, so call
// the server instead. // the server instead.