fix(esx_lib): make table.dump work and drop the shadowed contains

table.dump called its own table argument as a function, so it threw
"attempt to call a table value" for every table that had at least one
entry. An empty table returned "{ } " and a non-table returned tostring,
which is why it looks fine until you actually dump something.

table.contains was defined twice in the same file. Lua keeps the second
one, so the annotated version further up was unreachable. Removed the
unreachable one; behaviour is unchanged.
This commit is contained in:
Selt
2026-07-30 01:45:05 +02:00
parent 6cbc408102
commit a890abd110
+1 -8
View File
@@ -34,13 +34,6 @@ function xLib.table.searchForKey(tbl, item)
return nil
end
---@param tbl table
---@param item any
---@return boolean
function xLib.table.contains(tbl, item)
return xLib.table.searchForKey(tbl, item) ~= nil
end
---@param tbl table
---@param filter fun(value:any, key:any):boolean
---@return table
@@ -118,7 +111,7 @@ function xLib.table.dump(tbl)
local s = '{ '
for k,v in pairs(tbl) do
if type(k) ~= 'number' then k = '"'..k..'"' end
s = s .. '['..k..'] = ' .. tbl(v) .. ','
s = s .. '['..k..'] = ' .. xLib.table.dump(v) .. ','
end
return s .. '} '
else