On initiating this program i got no output, not even the compiler asked me for input
-
1You 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.Nifim– Nifim2020-11-10 14:56:01 +00:00Commented Nov 10, 2020 at 14:56
Add a comment
|
1 Answer
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