diff options
author | dmonty2 <dmonty@sd73.bc.ca> | 2014-03-16 22:26:58 -0700 |
---|---|---|
committer | dmonty2 <dmonty@sd73.bc.ca> | 2014-03-16 22:26:58 -0700 |
commit | 62be356cab50205780bbe20f003be47f51976585 (patch) | |
tree | afa1d183b776c49f5f5c475a9f66911d2690bedd /u_skins/players.lua | |
parent | 5e5810800664a1e5698b6f6dd0de7b033c09014e (diff) |
first commit
Diffstat (limited to 'u_skins/players.lua')
-rw-r--r-- | u_skins/players.lua | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/u_skins/players.lua b/u_skins/players.lua new file mode 100644 index 0000000..df999fb --- /dev/null +++ b/u_skins/players.lua @@ -0,0 +1,28 @@ +u_skins.file = minetest.get_worldpath() .. "/u_skins.mt" +u_skins.load = function() + local input = io.open(u_skins.file, "r") + local data = nil + if input then + data = input:read('*all') + end + if data and data ~= "" then + lines = string.split(data,"\n") + for _, line in ipairs(lines) do + data = string.split(line, ' ', 2) + u_skins.u_skins[data[1]] = data[2] + end + io.close(input) + end +end +u_skins.load() + +u_skins.save = function() + local output = io.open(u_skins.file,'w') + for name, skin in pairs(u_skins.u_skins) do + if name and skin then + output:write(name .. " " .. skin .. "\n") + end + end + io.close(output) +end + |