Comparison

util/datamanager.lua @ 456:27cb85d4059e

Fixed logging in datamanager
author Waqas Hussain <waqas20@gmail.com>
date Sat, 29 Nov 2008 05:53:11 +0500
parent 452:613c5c6bdce4
child 519:cccd610a0ef9
comparison
equal deleted inserted replaced
454:21105a005eef 456:27cb85d4059e
1 local format = string.format; 1 local format = string.format;
2 local setmetatable, type = setmetatable, type; 2 local setmetatable, type = setmetatable, type;
3 local pairs, ipairs = pairs, ipairs; 3 local pairs, ipairs = pairs, ipairs;
4 local char = string.char; 4 local char = string.char;
5 local loadfile, setfenv, pcall = loadfile, setfenv, pcall; 5 local loadfile, setfenv, pcall = loadfile, setfenv, pcall;
6 local log = log; 6 local log = require "util.logger".init("datamanager");
7 local io_open = io.open; 7 local io_open = io.open;
8 local os_remove = os.remove; 8 local os_remove = os.remove;
9 local tostring, tonumber = tostring, tonumber; 9 local tostring, tonumber = tostring, tonumber;
10 local error = error; 10 local error = error;
11 local next = next; 11 local next = next;
22 module "datamanager" 22 module "datamanager"
23 23
24 24
25 ---- utils ----- 25 ---- utils -----
26 local encode, decode; 26 local encode, decode;
27
28 local log = function (type, msg) return log(type, "datamanager", msg); end
29 27
30 do 28 do
31 local urlcodes = setmetatable({}, { __index = function (t, k) t[k] = char(tonumber("0x"..k)); return t[k]; end }); 29 local urlcodes = setmetatable({}, { __index = function (t, k) t[k] = char(tonumber("0x"..k)); return t[k]; end });
32 30
33 decode = function (s) 31 decode = function (s)