local function contains(tabela, valor)
for i = 1, #tabela do
if tabela[i] == valor then
return true
end
end
return false
end
local names = {"joão", "maria", "josé"}
if not contains(names, "carlos") then
table.insert(names, "carlos")
end
for i = 1, #names do
print(names[i])
end
--https://pt.stackoverflow.com/q/339407/101
bG9jYWwgZnVuY3Rpb24gY29udGFpbnModGFiZWxhLCB2YWxvcikKICAgIGZvciBpID0gMSwgI3RhYmVsYSBkbwogICAgICAgIGlmIHRhYmVsYVtpXSA9PSB2YWxvciB0aGVuIAogICAgICAgICAgICByZXR1cm4gdHJ1ZQogICAgICAgIGVuZAogICAgZW5kCiAgICByZXR1cm4gZmFsc2UKZW5kCgpsb2NhbCBuYW1lcyA9IHsiam/Do28iLCAibWFyaWEiLCAiam9zw6kifQppZiBub3QgY29udGFpbnMobmFtZXMsICJjYXJsb3MiKSB0aGVuCiAgICB0YWJsZS5pbnNlcnQobmFtZXMsICJjYXJsb3MiKQplbmQKZm9yIGkgPSAxLCAjbmFtZXMgZG8KICAgIHByaW50KG5hbWVzW2ldKQplbmQKCi0taHR0cHM6Ly9wdC5zdGFja292ZXJmbG93LmNvbS9xLzMzOTQwNy8xMDE=