Skip to content

Instantly share code, notes, and snippets.

@abaez
Last active January 3, 2016 13:09
Show Gist options
  • Save abaez/8467387 to your computer and use it in GitHub Desktop.
Save abaez/8467387 to your computer and use it in GitHub Desktop.
checks if a value exists in a table
--- checks if a value exist in a table.
-- @function exist
-- @param t a table to check.
-- @param w a value to look for.
function exist(t, w)
for _, v in ipairs(t) do
if v == w then
return true
end
end
return false
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment