projects
/
oweals
/
minetest.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7da4f9e
)
minetest,get_connected_players: Return empty table at load time (#9493)
author
sfan5
<sfan5@live.de>
Tue, 10 Mar 2020 19:32:04 +0000
(20:32 +0100)
committer
GitHub
<noreply@github.com>
Tue, 10 Mar 2020 19:32:04 +0000
(20:32 +0100)
src/script/lua_api/l_env.cpp
patch
|
blob
|
history
diff --git
a/src/script/lua_api/l_env.cpp
b/src/script/lua_api/l_env.cpp
index 352c75fb262ce5156c87c7cd09fbe875590c545b..3169fa4cfdce1dd2ad642245f8fd3cfd7bb61957 100644
(file)
--- 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;