From eb718cd729fa2582dd14909ab1b7e3e0fad18a7d Mon Sep 17 00:00:00 2001 From: whosit Date: Sat, 5 Apr 2025 08:38:19 +0300 Subject: [PATCH] make `players` iterator check for validity of players --- init.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 9f192b5..74f4f41 100644 --- a/init.lua +++ b/init.lua @@ -83,8 +83,12 @@ local function create_shared_environment(player_name) return core.get_player_by_name(n) end, __call = function(_t) - k, v = next(pl, k) - return v + while next(pl, k) do + k, v = next(pl, k) + if v:is_valid() then + return v + end + end end, } )