Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8065941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:49:33+00:00 2026-06-05T11:49:33+00:00

I am creating a small program to show off to my friends…. This is

  • 0

I am creating a small program to show off to my friends…. This is my first program, so I need lots of help.

My Problem:
I have text, a question, but how do I make a certain answer when you put in a certain line, like Noah? This is my code so far…

    local background = display.newImage( "white.png" )

    local text = display.newText( "Hello!", 25, 65, "Helvetica", 22 )
    text:setTextColor( 0, 128, 0 )

    local text = display.newText( "What is your name?", 25, 100, "Helvetica", 22 )
    text:setTextColor( 0, 128, 0 )

    local answer
    repeat
       io.write("What is your name?")
       io.flush()
       answer=io.read()
    until answer=="Emmy" or answer=="Mom" or answer=="Dad" or answer=="Noah"

I am trying out Corona SDK and it just keeps repeating “What is your name?”
What shall I do?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T11:49:36+00:00Added an answer on June 5, 2026 at 11:49 am

    I’d code the responses in a table. like this:

    local responses={Emmy="Hi Emmy!",Mom="Hi Mom!",Dad="Hi Dad!",Noah="Hi Noah!"}
    local answer
    repeat
        io.write("What is your name?\n")
        io.flush()
        answer=io.read()
    until responses[answer]
    print(responses[answer])
    

    This will look up the answer in the responses table, and return the requested answer if the person matches.

    Note, this logic will work for prompting and answering on the standard in and output. For GUI stuff (like Corona probably uses) you should use some of their functions or methods. I can imagine that the text objects generated with the newText() function might have a changeText (or value, or whatever method) to change the displayed text.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a some computation program. Now, this program is a single-thread, I need
I'm creating a small program that saves a int value into a text file,
I have a small Java program that reads list of IPs from text file
I'm creating a small program that will read a text file, which contains a
I am creating a small utility which will help to rebuild install.php of WordPress.
I am creating a small Yahtzee game and i have run into some regex
I am creating a small commercial web project running Apache/WSGI/Django/MySQL. I have a development
I'm creating a small prime number program, and am confused about one thing. I
am trying to get my head around the following: Have a small program am
I'm creating a small program which consists of a few source files on my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.