This is all about accepting input from user and searching with that particular text.
Playing with string.gsub
.
io.write("ENTER ANY STORY :-D ")
story=io.read()
io.write("\t OKAY!, THAT'S NICE :-D ")
io.write("\t DO YOU WANT TO REPLACE ANY TEXT:? ")
accept=io.read()
if accept=="YES" or "yes" then
io.write("\t WHICH TEXT TO REPLAE? ")
replace=io.read()
--HERE IS THE REPLACING TEXT
io.write("\t WITH WHAT:? ")
with=io.read()
result=string.gsub(story,replace,with)
print("\t THE REPLACED TEXT IS: ",result)
elseif accept=="NO" or "no" then
print(result)
end
Bug: The elseif
loop isn't working!!