-- 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()
local players = minetest.get_connected_players()
local str = ""
for i = 1, #players do
str = str .. players[i]:get_player_name() .. "\n"
end
minetest.safe_file_write(file_path, str)
end
minetest.register_on_mods_loaded(erase_player_list)
minetest.register_on_joinplayer(dump_player_list)
minetest.register_on_leaveplayer(dump_player_list)
minetest.register_on_shutdown(erase_player_list)