aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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