How to check if matching text is found in a string in Lua?
I need to make a conditional that is true if a particular matching text is found at least once in a string of text, e.g.: str = "This is some text containing the word tiger." if string.match(str, "tiger") then print ("The word tiger was found.") else print ("The word tiger was not found.") How can I check if the text is found somewhere in the string? You can use either of string.match or string.find . I personally use string.find() myself. Also, you need to specify end of your if-else statement. So, the actual code will be like: str = "This is some text containing the word tiger." if string