aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruno Thiago <45828157+brunotvs@users.noreply.github.com>2026-03-17 14:33:03 -0300
committerGitHub <noreply@github.com>2026-03-17 14:33:03 -0300
commit6b0a7f7f8770f5d21730a5f2fa8fcbc695687c43 (patch)
tree8fa3c8c6a2d52fc84c2b96762457dab3412e37d7 /src
parentdf425b4a24637797f552245685d7535ad9a56f7c (diff)
downloadluarocks-6b0a7f7f8770f5d21730a5f2fa8fcbc695687c43.tar.gz
luarocks-6b0a7f7f8770f5d21730a5f2fa8fcbc695687c43.tar.bz2
luarocks-6b0a7f7f8770f5d21730a5f2fa8fcbc695687c43.zip
fix: check if table entry is nil or not (#1867)
running ```luarocks config local_by_default``` returns ```Error: Unknown entry local_by_default``` and running ```luarocks config local_by_default true``` writes it as a string to the config file: ```lua local_by_default = "true" ``` Same is true to any bool var set as false. This pr aims to fix this issue.
Diffstat (limited to 'src')
-rw-r--r--src/luarocks/cmd/config.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/luarocks/cmd/config.lua b/src/luarocks/cmd/config.lua
index e8bda657..c350e42a 100644
--- a/src/luarocks/cmd/config.lua
+++ b/src/luarocks/cmd/config.lua
@@ -130,7 +130,7 @@ end
130 130
131local function print_entry(var, tbl, is_json) 131local function print_entry(var, tbl, is_json)
132 return traverse_varstring(var, tbl, function(t, k) 132 return traverse_varstring(var, tbl, function(t, k)
133 if not t[k] then 133 if t[k] == nil then
134 return nil, "Unknown entry " .. k 134 return nil, "Unknown entry " .. k
135 end 135 end
136 local val = t[k] 136 local val = t[k]
@@ -151,7 +151,7 @@ end
151local function infer_type(var) 151local function infer_type(var)
152 local typ 152 local typ
153 traverse_varstring(var, cfg, function(t, k) 153 traverse_varstring(var, cfg, function(t, k)
154 if t[k] then 154 if t[k] ~= nil then
155 typ = type(t[k]) 155 typ = type(t[k])
156 end 156 end
157 end) 157 end)