mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
minetest,get_connected_players: Return empty table at load time (#9493)
This commit is contained in:
parent
7da4f9ef20
commit
7a7bfdca7c
1 changed files with 7 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue