From 6b0a7f7f8770f5d21730a5f2fa8fcbc695687c43 Mon Sep 17 00:00:00 2001 From: Bruno Thiago <45828157+brunotvs@users.noreply.github.com> Date: Tue, 17 Mar 2026 14:33:03 -0300 Subject: 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. --- src/luarocks/cmd/config.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') 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 local function print_entry(var, tbl, is_json) return traverse_varstring(var, tbl, function(t, k) - if not t[k] then + if t[k] == nil then return nil, "Unknown entry " .. k end local val = t[k] @@ -151,7 +151,7 @@ end local function infer_type(var) local typ traverse_varstring(var, cfg, function(t, k) - if t[k] then + if t[k] ~= nil then typ = type(t[k]) end end) -- cgit v1.2.3-55-g6feb