Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return empty table when minetest.get_connected_players() is called at load time #9493

Merged
merged 1 commit into from Mar 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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