Mercurial > prosody-hg
diff util/pluginloader.lua @ 13925:a4c47203a9eb
various: Do not mutate loop variables as they are treated as const in Lua 5.5
Loop variables are treated as <const> in Lua 5.5 and can't be modified
without declaring another local.
Ref https://github.com/lua/lua/commit/b2f7b3b79f3117885b265575f6c5dbf934757797
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Fri, 23 Feb 2024 18:44:13 +0100 |
| parents | dde0ce03049b |
| children |
line wrap: on
line diff
--- a/util/pluginloader.lua Tue Aug 05 22:35:01 2025 +0200 +++ b/util/pluginloader.lua Fri Feb 23 18:44:13 2024 +0100 @@ -10,10 +10,9 @@ local dir_sep, path_sep = package.config:match("^(%S+)%s(%S+)"); local lua_version = _VERSION:match(" (.+)$"); local plugin_dir = {}; -for path in (CFG_PLUGINDIR or "./plugins/"):gsub("[/\\]", dir_sep):gmatch("[^"..path_sep.."]+") do - path = path..dir_sep; -- add path separator to path end - path = path:gsub(dir_sep..dir_sep.."+", dir_sep); -- coalesce multiple separators - plugin_dir[#plugin_dir + 1] = path; +for path in (CFG_PLUGINDIR or "./plugins/"):gsub("[/\\]", dir_sep):gmatch("[^" .. path_sep .. "]+") do + plugin_dir[#plugin_dir + 1] = (path .. dir_sep) -- add path separator to path end + :gsub(dir_sep .. dir_sep .. "+", dir_sep); -- coalesce multiple separators end local io_open = io.open;
