lint: Fix accessing undefined append_inplace

Fix crash when using append_inplace without batteries:export().

If you don't export batteries into the global namespace to stomp table,
then append_inplace would access a nil function because it's using table
instead of tablex.

We still use table inside init, but that's after we export to global
namespace.
This commit is contained in:
David Briscoe 2022-03-02 10:12:30 -08:00
parent a5ebc1e501
commit 9083ee74ca
2 changed files with 2 additions and 2 deletions

View File

@ -1,7 +1,6 @@
return {
std = "lua51+love",
ignore = {
"143", -- Accessing an undefined field of a global variable.
"211", -- Unused local variable.
"212", -- Unused argument.
"212/self", -- Unused argument self.
@ -25,6 +24,7 @@ return {
ignore = {
"111", -- Setting an undefined global variable. (batteries and ripairs)
"121", -- Setting a read-only global variable. (we clobber assert)
"143", -- Accessing an undefined field of a global variable. (we use tablex as table)
},
},
["sort.lua"] = {

View File

@ -282,7 +282,7 @@ function tablex.append_inplace(t1, t2, ...)
table.insert(t1, v)
end
if ... then
return table.append_inplace(t1, ...)
return tablex.append_inplace(t1, ...)
end
return t1
end