factions/ip.lua

28 lines
836 B
Lua
Raw Normal View History

2018-10-15 17:24:58 +02:00
factions_ip = {}
factions_ip.player_ips = {}
--read some basic information
local factions_worldid = minetest.get_worldpath()
function factions_ip.save()
2018-10-17 04:58:15 +02:00
local file,error = io.open(factions_worldid .. "/" .. "factions_iplist.txt","w")
2018-10-15 17:24:58 +02:00
if file ~= nil then
file:write(minetest.serialize(factions_ip.player_ips))
file:close()
else
minetest.log("error","MOD factions: unable to save faction player ips!: " .. error)
end
end
function factions_ip.load()
2018-10-17 04:58:15 +02:00
local file,error = io.open(factions_worldid .. "/" .. "factions_iplist.txt","r")
2018-10-15 17:24:58 +02:00
if file ~= nil then
local raw_data = file:read("*a")
factions_ip.player_ips = minetest.deserialize(raw_data)
file:close()
else
minetest.log("error","MOD factions: unable to load faction player ips!: " .. error)
end
end