Need help with my lua

Discussion in 'Python' started by Thiefcom, Aug 22, 2017.

  1. Thiefcom

    Thiefcom

    Joined:
    Jun 1, 2017
    Messages:
    50
    Likes Received:
    6
    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
     
    Thiefcom, Aug 22, 2017
    #1
    1. Advertisements

  2. Thiefcom

    John Joe

    Joined:
    Apr 25, 2017
    Messages:
    63
    Likes Received:
    11
    Location:
    Malaysia
    Don't work mean ? Where are all the semicolon ?
     
    John Joe, Aug 22, 2017
    #2
    1. Advertisements

  3. Thiefcom

    Thiefcom

    Joined:
    Jun 1, 2017
    Messages:
    50
    Likes Received:
    6
    I saw how to make the code and wrote it word by word but it did not work I got the lua exit error
     
    Thiefcom, Aug 24, 2017
    #3
  4. Thiefcom

    John Joe

    Joined:
    Apr 25, 2017
    Messages:
    63
    Likes Received:
    11
    Location:
    Malaysia
    Zero knowledge for python....Sorry
     
    John Joe, Aug 24, 2017
    #4
    1. 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 (here). After that, you can post your question and our members will help you out.