Fixed the common idiom of setting a plugin to true. (#1152)

This commit is contained in:
Adam 2022-10-20 18:04:28 -04:00 committed by GitHub
parent 437b954595
commit dd6eee1542
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -56,8 +56,9 @@ config.plugins = {}
-- Allow you to set plugin configs even if we haven't seen the plugin before.
setmetatable(config.plugins, {
__index = function(t, k)
if rawget(t, k) == nil then rawset(t, k, {}) end
return rawget(t, k)
local v = rawget(t, k)
if v == true or v == nil then v = {} rawset(t, k, v) end
return v
end
})