Comparison

util/datamanager.lua @ 3845:4860853fc97b

util.datamanager: Return an error string when pcall fails on a loaded list file.
author Waqas Hussain <waqas20@gmail.com>
date Fri, 10 Dec 2010 00:23:47 +0500
parent 3844:9cdc19ed3034
child 4093:36555949bd16
comparison
equal deleted inserted replaced
3844:9cdc19ed3034 3845:4860853fc97b
217 local items = {}; 217 local items = {};
218 setfenv(data, {item = function(i) t_insert(items, i); end}); 218 setfenv(data, {item = function(i) t_insert(items, i); end});
219 local success, ret = pcall(data); 219 local success, ret = pcall(data);
220 if not success then 220 if not success then
221 log("error", "Unable to load "..datastore.." storage ('"..ret.."') for user: "..(username or "nil").."@"..(host or "nil")); 221 log("error", "Unable to load "..datastore.." storage ('"..ret.."') for user: "..(username or "nil").."@"..(host or "nil"));
222 return nil; 222 return nil, "Error reading storage";
223 end 223 end
224 return items; 224 return items;
225 end 225 end
226 226
227 return _M; 227 return _M;