add check for table contains

This commit is contained in:
gabryon99 2020-11-17 09:40:18 +01:00
parent 95248e7424
commit d2babc3d24

View file

@ -3944,6 +3944,7 @@ function table.contains(t, needle, comp)
if (t == nil) then return false end
if (type(t) ~= "table") then return false end
if (#t == 0) then return false end
local default_compare = (function(e) return e == needle end)
comp = comp or default_compare