You don't have to use a mod, you can do it yourself like this:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
local data = {}
local data_filename = minetest.get_worldpath().."/filename.txt"
local function load_data()
local file = io.open(data_filename, "r")
if file then
local table = minetest.deserialize(file:read("*all"))
file:close()
if type(table) == "table" then
data = table
return
end
end
end
local function save_data()
local file = io.open(data_filename, "w")
if file then
file:write(minetest.serialize(data))
file:close()
end
end
load_data()