function table.find(t, value)
for _, v in pairs(t) do
if v == value then
return v
end
end
return nil
end
local Words = {
"Yeah",
"Hello",
"Filler"
}
local Message = "Hello"
if Message:match(table.find(Words, Message)) then
print(true)
end
The only way I can think of doing this is using concat.
function table.find(t, value)
local concat_str = table.concat(t, '\0')
local start, _ = concat_str:find(value, 1, true)
if start then
local index = select(2, concat_str:sub(1, start):gsub('\0', ''))
return t[index]
else
return nil
end
end