Comparison

core/configmanager.lua @ 4001:2e8411f6cb14

configmanager: Added rawget().
author Waqas Hussain <waqas20@gmail.com>
date Wed, 05 Jan 2011 06:16:07 +0500
parent 3929:7cb03d67101b
child 4358:86be454168fb
comparison
equal deleted inserted replaced
4000:ca91d6e1d802 4001:2e8411f6cb14
44 local sec = config[host][section]; 44 local sec = config[host][section];
45 if sec then 45 if sec then
46 return sec[key]; 46 return sec[key];
47 end 47 end
48 return nil; 48 return nil;
49 end
50 function _M.rawget(host, section, key)
51 local hostconfig = rawget(config, host);
52 if hostconfig then
53 local sectionconfig = rawget(hostconfig, section);
54 if sectionconfig then
55 return rawget(sectionconfig, key);
56 end
57 end
49 end 58 end
50 59
51 local function set(config, host, section, key, value) 60 local function set(config, host, section, key, value)
52 if host and section and key then 61 if host and section and key then
53 local hostconfig = rawget(config, host); 62 local hostconfig = rawget(config, host);