0
我在做这个Lua代码有什么问题? 我正在尝试生成两个随机数,并询问它们在一起倍增。 第一部分是好的,但不管我输入什么答案,它总是认为它是不正确的。 请告诉我我做错了什么,以及如何解决它。请记住这是Lua。Lua和用户输入
math.randomseed(os.time())
local a=math.random(10)
local b=math.random(10)
local answer
repeat
io.write("What is ",a,"*",b,"?")
io.flush()
answer=io.read()
if answer==a*b then
print("Correct!")
else
print("Try Again")
end
until
answer==a*b
谢谢凯文。非常有帮助 – user2059810 2013-03-15 23:08:04
@ user2059810欢迎来到stackoverflow!考虑接受凯文的答案(通过点击复选标记)给他一些荣誉,并向未来的访问者展示你的问题已经解决(以及如何) – 2013-03-16 00:00:12