-- by gera, public domain
local file_path = minetest.get_worldpath() .. "/online_players.txt"
function erase_player_list()
minetest.safe_file_write(file_path , "")
end
function dump_player_list(excludeme)
local players = minetest.get_connected_players()
local str = ""
for i = 1, #players do
if players[i] ~= excludeme then
str = str .. players[i]:get_player_name() .. "\n"
end
end
minetest.safe_file_write(file_path, str)
end
minetest.register_on_mods_loaded(erase_player_list)
minetest.register_on_joinplayer(function() dump_player_list(nil) end)
minetest.register_on_leaveplayer(dump_player_list)
minetest.register_on_shutdown(erase_player_list)