On initiating this program i got no output, not even the compiler asked me for input
Asked
Active
Viewed 117 times
-2

MattDMo
- 100,794
- 21
- 241
- 231
-
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 Nov 10 '20 at 14:56
1 Answers
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

Doyousketch2
- 2,060
- 1
- 11
- 11