diff options
author | sfan5 <sfan5@live.de> | 2020-03-10 20:32:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-10 20:32:04 +0100 |
commit | 7a7bfdca7c2dcbfe40467f64544112551abd7316 (patch) | |
tree | 23f520bcca11bc7ba65c5aef792cf870c27a1c69 /src | |
parent | 7da4f9ef2071b64943a28f662b786f95d5f898e4 (diff) | |
download | minetest-7a7bfdca7c2dcbfe40467f64544112551abd7316.tar.gz minetest-7a7bfdca7c2dcbfe40467f64544112551abd7316.tar.bz2 minetest-7a7bfdca7c2dcbfe40467f64544112551abd7316.zip |
minetest,get_connected_players: Return empty table at load time (#9493)
Diffstat (limited to 'src')
-rw-r--r-- | src/script/lua_api/l_env.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/script/lua_api/l_env.cpp b/src/script/lua_api/l_env.cpp index 352c75fb2..3169fa4cf 100644 --- a/src/script/lua_api/l_env.cpp +++ b/src/script/lua_api/l_env.cpp @@ -643,7 +643,13 @@ int ModApiEnvMod::l_add_item(lua_State *L) // get_connected_players() int ModApiEnvMod::l_get_connected_players(lua_State *L) { - GET_ENV_PTR; + ServerEnvironment *env = (ServerEnvironment *) getEnv(L); + if (!env) { + log_deprecated(L, "Calling get_connected_players() at mod load time" + " is deprecated"); + lua_createtable(L, 0, 0); + return 1; + } lua_createtable(L, env->getPlayerCount(), 0); u32 i = 0; |