accept a value depending of a list

Hi how to make to accept a value in function of a table?

For example i have a value 45 and the other side i have the list of value 10,45,56.

I want that my function accept the value 45 because she is in the list.

Thanks for your help

Probably this will help: http://lua-users.org/wiki/SetOperations

Specifically:

[lua]function Set(t)

    local s = {}
    for _,v in pairs(t) do s[v] = true end
    return s
end

function contains(t, e)
    return t[e]
end

t = Set{10, 45, 56}

print (contains(t,45)) --> true

[/lua]

Super thanks it’s what i’m lookink for .

Probably this will help: http://lua-users.org/wiki/SetOperations

Specifically:

[lua]function Set(t)

    local s = {}
    for _,v in pairs(t) do s[v] = true end
    return s
end

function contains(t, e)
    return t[e]
end

t = Set{10, 45, 56}

print (contains(t,45)) --> true

[/lua]

Super thanks it’s what i’m lookink for .