Comparison

core/configmanager.lua @ 4067:db98915e8e30

configmanager: Added rawget().
author Waqas Hussain <waqas20@gmail.com>
date Wed, 05 Jan 2011 06:16:07 +0500
parent 4013:d43177026cda
child 4358:86be454168fb
comparison
equal deleted inserted replaced
4066:461812921f8f 4067:db98915e8e30
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);