Trying to make a function that finds the concatenation of words in a table or array.
So basically in the table below the answer printed should be catsdog because cats ,dog, and catsdog are in the table
I made a simple function to do this but how do I make a better function so that if I run the function with any string table it finds the answer without me having to manually put in x=2,y=3…etc
function setup()
input = {"cat","cats","dog","catsdog",}
findconcat(input)
end
function findconcat(array)
x=2
y=3
z=4
if array[x]..array[y]==array[z] then
print(array[z])
end
end