这就是接受用户的输入并使用该特定文本进行搜索。
玩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
错误:elseif
循环不起作用!