Software /
code /
prosody
Comparison
core/modulemanager.lua @ 2072:464a5392bc80
modulemanager: api:get_option(): Handle correctly option values of boolean false, don't assume value unset
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 08 Nov 2009 15:09:11 +0000 |
parent | 1994:9cc9b096c8f5 |
child | 2151:3bb7c1daa93f |
child | 2828:fbddc3ed0d09 |
comparison
equal
deleted
inserted
replaced
2071:d59537f54c24 | 2072:464a5392bc80 |
---|---|
388 setfenv(f, setmetatable({ module = self }, { __index = _G })); | 388 setfenv(f, setmetatable({ module = self }, { __index = _G })); |
389 return f(); | 389 return f(); |
390 end | 390 end |
391 | 391 |
392 function api:get_option(name, default_value) | 392 function api:get_option(name, default_value) |
393 return config.get(self.host, self.name, name) or config.get(self.host, "core", name) or default_value; | 393 local value = config.get(self.host, self.name, name); |
394 if value == nil then | |
395 value = config.get(self.host, "core", name); | |
396 if value == nil then | |
397 value = default_value; | |
398 end | |
399 end | |
400 return value; | |
394 end | 401 end |
395 | 402 |
396 local t_remove = _G.table.remove; | 403 local t_remove = _G.table.remove; |
397 local module_items = multitable_new(); | 404 local module_items = multitable_new(); |
398 function api:add_item(key, value) | 405 function api:add_item(key, value) |