Misc mod data
Made for auto converter.
This commit is contained in:
38
misc_mod_data.lua
Normal file
38
misc_mod_data.lua
Normal file
@ -0,0 +1,38 @@
|
||||
misc_mod_data = {}
|
||||
misc_mod_data.data = {factions_version = "0.8.1"}
|
||||
|
||||
--read some basic information
|
||||
local factions_worldid = minetest.get_worldpath()
|
||||
|
||||
function misc_mod_data.save()
|
||||
local file,error = io.open(factions_worldid .. "/" .. "factions_misc_mod_data.txt","w")
|
||||
|
||||
if file ~= nil then
|
||||
file:write(minetest.serialize(misc_mod_data.data))
|
||||
file:close()
|
||||
else
|
||||
minetest.log("error","MOD factions: unable to save factions misc mod data!: " .. error)
|
||||
end
|
||||
end
|
||||
|
||||
function misc_mod_data.load()
|
||||
local file,error = io.open(factions_worldid .. "/" .. "factions_misc_mod_data.txt","r")
|
||||
|
||||
if file ~= nil then
|
||||
local raw_data = file:read("*a")
|
||||
misc_mod_data.data = minetest.deserialize(raw_data)
|
||||
file:close()
|
||||
else
|
||||
misc_mod_data.save()
|
||||
end
|
||||
end
|
||||
|
||||
function misc_mod_data.check_file()
|
||||
local file,error = io.open(factions_worldid .. "/" .. "factions_misc_mod_data.txt","r")
|
||||
|
||||
if file ~= nil then
|
||||
file:close()
|
||||
else
|
||||
misc_mod_data.save()
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user