Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function publishplayerlist()
- result = "";
- for _,player in ipairs(minetest.get_connected_players()) do
- result = result .. player:get_player_name() .. ", "
- end
- playerlistfilename = minetest.get_modpath("utils") .. "/currentplayers.txt"
- -- this following command is under comment ... because not nice ...
- --os.execute("/bin/echo '" .. result .. "' > " .. playerlistfilename)
- -- here a nicer way .. Thanks to the friends of IRC freenode #minetest friends
- local file = io.open(minetest.get_modpath("utils") .. "/currentplayers.txt", "w")
- file, err = io.open(filename, "w");
- if (not file) then
- -- write to log error ... do not shutdown server , if this crap append
- print(dump(err))
- else
- file:write(result)
- file:close()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement