Mercurial > prosody-hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 13924:7fdf7645b0da | 13925:a4c47203a9eb |
|---|---|
| 8 -- luacheck: ignore 113/CFG_PLUGINDIR | 8 -- luacheck: ignore 113/CFG_PLUGINDIR |
| 9 | 9 |
| 10 local dir_sep, path_sep = package.config:match("^(%S+)%s(%S+)"); | 10 local dir_sep, path_sep = package.config:match("^(%S+)%s(%S+)"); |
| 11 local lua_version = _VERSION:match(" (.+)$"); | 11 local lua_version = _VERSION:match(" (.+)$"); |
| 12 local plugin_dir = {}; | 12 local plugin_dir = {}; |
| 13 for path in (CFG_PLUGINDIR or "./plugins/"):gsub("[/\\]", dir_sep):gmatch("[^"..path_sep.."]+") do | 13 for path in (CFG_PLUGINDIR or "./plugins/"):gsub("[/\\]", dir_sep):gmatch("[^" .. path_sep .. "]+") do |
| 14 path = path..dir_sep; -- add path separator to path end | 14 plugin_dir[#plugin_dir + 1] = (path .. dir_sep) -- add path separator to path end |
| 15 path = path:gsub(dir_sep..dir_sep.."+", dir_sep); -- coalesce multiple separators | 15 :gsub(dir_sep .. dir_sep .. "+", dir_sep); -- coalesce multiple separators |
| 16 plugin_dir[#plugin_dir + 1] = path; | |
| 17 end | 16 end |
| 18 | 17 |
| 19 local io_open = io.open; | 18 local io_open = io.open; |
| 20 local envload = require "prosody.util.envload".envload; | 19 local envload = require "prosody.util.envload".envload; |
| 21 | 20 |
