From 2dc6348a2b3f0c9376bf9a652886a3956970e070 Mon Sep 17 00:00:00 2001 From: Thijs Schreijer Date: Fri, 22 Jul 2022 10:54:25 +0200 Subject: fix(compat) use rawget to bypass "strict" checkers (#437) --- CHANGELOG.md | 2 ++ 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 -- cgit v1.2.3