Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(compat) use rawget to bypass "strict" checkers #437

Merged
merged 1 commit into from
Jul 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lua/pl/compat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
alerque marked this conversation as resolved.
Show resolved Hide resolved
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
Expand Down