Varscott11 0 Posted June 10, 2017 Share Posted June 10, 2017 how can I create a file with a certain extension on an hdd from lua code? Looked through the FilesystemAPI but can't seem to find a function to do it Quote Link to post Share on other sites
1 Solution Gorzoid 10 Posted June 10, 2017 Solution Share Posted June 10, 2017 filesystem.open or io.open used like this local io = require("io") local f = io.open("file.txt","w") f:write("file contents") f:close() Quote Link to post Share on other sites
0 payonel 21 Posted June 27, 2017 Share Posted June 27, 2017 Allow me to comment on this code suggestion: On 6/10/2017 at 2:43 PM, Gorzoid said: filesystem.open or io.open used like this local io = require("io") local f = io.open("file.txt","w") f:write("file contents") f:close() You do not need to require("io"), it is a global library and I recommend using io.open 1. the read/write is buffered (more options, better perf) 2. the path is relative, fs.open is always absolute read more here: http://ocdoc.cil.li/api:non-standard-lua-libs#input_and_output_facilities Quote Link to post Share on other sites
how can I create a file with a certain extension on an hdd from lua code? Looked through the FilesystemAPI but can't seem to find a function to do it
Link to post
Share on other sites