How to check if a table contains an element in Lua?
snippet in lua

How to check if a table contains an element in Lua?

user5239

function addToSet(set, key)
    set[key] = true
end

function removeFromSet(set, key)
    set[key] = nil
end

function setContains(set, key)
    return set[key] ~= nil
end