equal
deleted
inserted
replaced
86 end |
86 end |
87 |
87 |
88 function load(username, host, datastore) |
88 function load(username, host, datastore) |
89 local data, ret = loadfile(getpath(username, host, datastore)); |
89 local data, ret = loadfile(getpath(username, host, datastore)); |
90 if not data then |
90 if not data then |
91 log("warn", "Failed to load "..datastore.." storage ('"..ret.."') for user: "..(username or "nil").."@"..(host or "nil")); |
91 log("debug", "Failed to load "..datastore.." storage ('"..ret.."') for user: "..(username or "nil").."@"..(host or "nil")); |
92 return nil; |
92 return nil; |
93 end |
93 end |
94 setfenv(data, {}); |
94 setfenv(data, {}); |
95 local success, ret = pcall(data); |
95 local success, ret = pcall(data); |
96 if not success then |
96 if not success then |
161 end |
161 end |
162 |
162 |
163 function list_load(username, host, datastore) |
163 function list_load(username, host, datastore) |
164 local data, ret = loadfile(getpath(username, host, datastore, "list")); |
164 local data, ret = loadfile(getpath(username, host, datastore, "list")); |
165 if not data then |
165 if not data then |
166 log("warn", "Failed to load "..datastore.." storage ('"..ret.."') for user: "..(username or "nil").."@"..(host or "nil")); |
166 log("debug", "Failed to load "..datastore.." storage ('"..ret.."') for user: "..(username or "nil").."@"..(host or "nil")); |
167 return nil; |
167 return nil; |
168 end |
168 end |
169 local items = {}; |
169 local items = {}; |
170 setfenv(data, {item = function(i) t_insert(items, i); end}); |
170 setfenv(data, {item = function(i) t_insert(items, i); end}); |
171 local success, ret = pcall(data); |
171 local success, ret = pcall(data); |