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
 
Ad

Advertisements

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
 
Ad

Advertisements


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

Top