-2

On initiating this program i got no output, not even the compiler asked me for input

1
  • 1
    You should include the code in your post in text form, not in a link to an image. code in image form puts more work on the person you are looking for help from, and as a result deters them from bothering to help. Commented Nov 10, 2020 at 14:56

1 Answer 1

0

You're supposed to submit text, not images.

That being said: Your script is fine, but Sublime pipes output to the editor, but isn't a full terminal, so doesn't allow input.

#! /usr/bin/env lua

io.write( 'Enter a number : ' )
local a = io.stdin:read('*n')

while a < 200 do
    print( 'value of a :', a )
    a = a +1
end

You'll have to open an actual terminal, cd into the relevant directory, then run your script.

chmod +x NAME_OF_SCRIPT.lua && ./NAME_OF_SCRIPT.lua

or

lua NAME_OF_SCRIPT.lua

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.