123456789101112131415161718192021222324252627 |
- function teleport.load()
- local file = io.open(minetest.get_worldpath() .. '/teleport_systems', 'r')
- if file then
- teleport.data = minetest.deserialize(file:read('*a'))
- file:close()
- else
- teleport.data = {}
- end
- end
- function teleport.save()
- local file = io.open(minetest.get_worldpath() .. '/teleport_systems', 'w')
- file:write(minetest.serialize(teleport.data))
- file:close()
- end
- function teleport.find_stations()
- local stations = teleport.data
- local results = {}
- for strpos, data in pairs(stations) do
- local obj = data.name..'|'..strpos
- table.insert(results, obj)
- end
- table.sort(results)
- teleport.other_stations = results
- end
|