How do you make a search box that can look through a table without needing the whole name? Eg. if you type "alpha" it would show everything that starts with "alpha" like "Alpha" and "Alphabet" depending on whatevers in the table. Thanks
Note, I'm not looking for someone to write the script - even a wiki link would be handy as all I've found was people talking about web features. Thanks
String.match is great in situations like this.
words = {"Test1","Test3","sdfdsf","sdtgr"} for i,v in pairs(words) do local checkMatch = string.match(v,"sd") if checkMatch then print(v.." matches with sd!") else print(v.." doesn't match with sd!") end end
In the code above we have a table containing four strings. Once we declare the table we loop through it and check if the item in the table we're checking currently has "sd" in it. If that's the case we print that it does match with sd. If not, we print it doesn't match with it.