You can use the match
or find
functions to find the string you want. Both return a Boolean value indicating the presence of string
string.match("oi\ntchau\nhi\nbye", "hi")
Documentation match
string.find("oi\ntchau\nhi\nbye", "hi")
Documentation find
Both solve your problem if you just want to know whether or not it contains the searched string . The result can be used in if
without problems.
If not, you need to be more specific in the question and show what you have already done, and point out the problem.
See running on ideone . And at Coding Ground . Also put it on GitHub for future reference .