Need help with my lua

Joined
Jun 1, 2017
Messages
55
Reaction score
7
local lives = 10
local randomnum = math.random(1 , 50)

print("Welcome to higher or lower.")

while live > 0 do

print("You have"..lives.."Left, Guess the number!")

local number = io.read()
number = tonumber(number)

if number == randomnumber then

print("Your right")

break
elseif number < randomnumber then

print("Guess higher!")

elseif number > randomnumber then

print("Guess lower!")

if lives <= 0 then

print("You failed")

break
end
end

io.read()

Help me don't work
 
Joined
Jun 1, 2017
Messages
55
Reaction score
7
I saw how to make the code and wrote it word by word but it did not work I got the lua exit error
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top