Lua is case sensitive,
function getRandomNumber(maxValue)
print "Guess number"
math.randomseed(os.time())
math.random()
return math.random(maxValue)
end
number= getRandomNumber(100)
print(number)
while answer ~= number do
answer = io.read("*n")
if answer < number then
print("too low")
elseif answer > number then
print ("too high")
else
print "got it"
end
end
print(number)
print(answer)
No comments:
Post a Comment