mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 00:01:20 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user