Skip to content
This repository has been archived by the owner on Sep 21, 2021. It is now read-only.

Commit

Permalink
minetest,get_connected_players: Return empty table at load time (mine…
Browse files Browse the repository at this point in the history
  • Loading branch information
sfan5 authored and aldum committed Apr 16, 2020
1 parent aaf5a1a commit 9ebc246
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/script/lua_api/l_env.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit 9ebc246

Please sign in to comment.