aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api
diff options
context:
space:
mode:
authorZughy <63455151+Zughy@users.noreply.github.com>2022-08-10 18:03:57 +0200
committersfan5 <sfan5@live.de>2022-09-14 13:37:44 +0200
commit96e35585b042222a026f5c0816492672000a2330 (patch)
treeb537a09241ab19d6a39abb1dda559db6913a4ecc /src/script/lua_api
parentf035fe9336f80bfc9423e7ee0b1fde128844dbe6 (diff)
downloadminetest-96e35585b042222a026f5c0816492672000a2330.tar.gz
minetest-96e35585b042222a026f5c0816492672000a2330.tar.bz2
minetest-96e35585b042222a026f5c0816492672000a2330.zip
Fix crash when stars are reset
Diffstat (limited to 'src/script/lua_api')
-rw-r--r--src/script/lua_api/l_object.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp
index 6bd07a4c1..d6498bfa8 100644
--- a/src/script/lua_api/l_object.cpp
+++ b/src/script/lua_api/l_object.cpp
@@ -1366,7 +1366,7 @@ int ObjectRef::l_get_player_control(lua_State *L)
lua_newtable(L);
if (player == nullptr)
return 1;
-
+
const PlayerControl &control = player->getPlayerControl();
lua_pushboolean(L, control.direction_keys & (1 << 0));
lua_setfield(L, -2, "up");
@@ -2082,11 +2082,10 @@ int ObjectRef::l_set_stars(lua_State *L)
star_params.scale = getfloatfield_default(L, 2,
"scale", star_params.scale);
+ star_params.day_opacity = getfloatfield_default(L, 2,
+ "day_opacity", star_params.day_opacity);
}
- star_params.day_opacity = getfloatfield_default(L, 2,
- "day_opacity", star_params.day_opacity);
-
getServer(L)->setStars(player, star_params);
return 0;
}