aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2013-12-20 18:13:11 -0200
committerHisham Muhammad <hisham@gobolinux.org>2013-12-20 18:13:11 -0200
commite13d4e0e377a5fce26f335c4e7e66db1377a519f (patch)
tree2d819f44e10fb56aa72566983c7c200c3647d3dc
parentdfce4837addfe258566b6e48dd28a9e7c72bbf62 (diff)
downloadluarocks-e13d4e0e377a5fce26f335c4e7e66db1377a519f.tar.gz
luarocks-e13d4e0e377a5fce26f335c4e7e66db1377a519f.tar.bz2
luarocks-e13d4e0e377a5fce26f335c4e7e66db1377a519f.zip
Use same loop for both arrays
-rw-r--r--src/luarocks/cfg.lua27
1 files changed, 9 insertions, 18 deletions
diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua
index 0ff8f537..2904146b 100644
--- a/src/luarocks/cfg.lua
+++ b/src/luarocks/cfg.lua
@@ -472,25 +472,16 @@ end
472 472
473-- Use defaults: 473-- Use defaults:
474 474
475-- Populate values from 'defaults.variables' in 'variables' if they were not 475-- Populate some arrays with values from their 'defaults' counterparts
476-- already set by user. 476-- if they were not already set by user.
477if not _M.variables then 477for _, entry in ipairs({"variables", "rocks_provided"}) do
478 _M.variables = {} 478 if not _M[entry] then
479end 479 _M[entry] = {}
480for k,v in pairs(defaults.variables) do
481 if not _M.variables[k] then
482 _M.variables[k] = v
483 end 480 end
484end 481 for k,v in pairs(defaults[entry]) do
485 482 if not _M[entry][k] then
486-- Populate values from 'defaults.rocks_provided' in 'rocks_provided' if they 483 _M[entry][k] = v
487-- were not already set by user. 484 end
488if not type(_M.rocks_provided) == "table" then
489 _M.rocks_provided = {}
490end
491for k,v in pairs(defaults.rocks_provided) do
492 if not _M.rocks_provided[k] then
493 _M.rocks_provided[k] = v
494 end 485 end
495end 486end
496 487