diff options
author | Thijs Schreijer <thijs@thijsschreijer.nl> | 2022-07-22 11:54:25 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-22 11:54:25 +0300 |
commit | 2dc6348a2b3f0c9376bf9a652886a3956970e070 (patch) | |
tree | c90ab6fed1c43cfccca3d199329b544620113a4a | |
parent | 07a6d3bc8032f678330220457e3f298170c01057 (diff) |
fix(compat) use rawget to bypass "strict" checkers (#437)
-rw-r--r-- | CHANGELOG.md | 2 | ||||
-rw-r--r-- | lua/pl/compat.lua | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index f65377b..d157477 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ see [CONTRIBUTING.md](CONTRIBUTING.md#release-instructions-for-a-new-version) fo [#413](https://github.com/lunarmodules/Penlight/pull/413) - feat: `utils.kpairs` new iterator over all non-integer keys [#413](https://github.com/lunarmodules/Penlight/pull/413) + - fix: `warn` use rawget to not trigger strict-checkers + [#437](https://github.com/lunarmodules/Penlight/pull/437) - fix: `lapp` provides the file name when using the default argument [#427](https://github.com/lunarmodules/Penlight/pull/427) - fix: `lapp` positional arguments now allow digits after the first character diff --git a/lua/pl/compat.lua b/lua/pl/compat.lua index e466494..7791009 100644 --- a/lua/pl/compat.lua +++ b/lua/pl/compat.lua @@ -225,9 +225,9 @@ end -- This functions mimics the `warn` function added in Lua 5.4. -- @function warn -- @param ... any arguments -if not warn then -- luacheck: ignore +if not rawget(_G, warn) then local enabled = false - local function warn(arg1, ...) -- luacheck: ignore + local function warn(arg1, ...) if type(arg1) == "string" and arg1:sub(1, 1) == "@" then -- control message if arg1 == "@on" then |