diff options
-rw-r--r-- | changelog.md | 1 | ||||
-rw-r--r-- | script/config.lua | 24 |
2 files changed, 21 insertions, 4 deletions
diff --git a/changelog.md b/changelog.md index 73055697..895dbc33 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,7 @@ ## 1.18.0 * `CHG` `Windows`: dose not provide `ucrt` any more +* `CHG` `Lua.workspace.library`: use `path[]` instead of `<path, true>` * `FIX` missed syntax error `local a <const>= 1` ## 1.17.4 diff --git a/script/config.lua b/script/config.lua index 3d8b9fda..18525c13 100644 --- a/script/config.lua +++ b/script/config.lua @@ -44,6 +44,25 @@ local function Str2Hash(sep) end end +local function Array2Hash(checker) + return function (tbl) + if type(tbl) ~= 'table' then + return false + end + local t = {} + if #tbl > 0 then + for _, k in ipairs(tbl) do + t[k] = true + end + else + for k, v in pairs(tbl) do + t[k] = v + end + end + return true, t + end +end + local function Array(checker) return function (tbl) if type(tbl) ~= 'table' then @@ -129,10 +148,7 @@ local ConfigTemplate = { useGitIgnore = {true, Boolean}, maxPreload = {1000, Integer}, preloadFileSize = {100, Integer}, - library = {{}, Hash( - String, - Or(Boolean, Array(String)) - )} + library = {{}, Array2Hash(String)}, }, completion = { enable = {true, Boolean}, |