File not working in Lua -


i doing small program school in lua, need help. open file, when write, nothing appears in .txt file. can help? snippet of code trying fix:

file=io.open('var.txt',"w+")      io.output(file)      io.write('hi!') 

edit: tried file:close() , io.flush(), haven't managed make work.

try following:

io.output('var.txt') io.write('hi!') io.close() 

the function io.output allows specify current file output filename. in example, passing file handler created io.open instead of filename. implicitly creates bad file handler io.write cannot use.

for more info, check out chapter on "the simple i/o model" "programming in lua".


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -