DusterTheFirst, on 23 June 2016 - 11:24 AM, said:
Sewbacca, on 23 June 2016 - 11:13 AM, said:
DusterTheFirst, on 23 June 2016 - 10:45 AM, said:
also is it possible to save a file while it is opened in fs(API)?
Nope, because Java allows just one handle per file at one time and CC is based on Java.
Also just the fs(API) can open files, so with io(API) would it fail either.
what if i periodicly opened and closed the file in fs(api) could i edit the file between then?
After closing the file, the handle is useless and you have to create a new one, so yes, but If you want to edit a file at the same time, why you don't do this:
local h = fs.open(...)
local file = loadfile('aFile', {handle = h}) --Note that in this case, the program have just access to the handle.
parallel.waitForAll(file, main)
File is the file which needs the handle and you set the environment variable handle to h, so in the file, handle.write(...) would work.
Main is your program. Both programs have access to the handle.
Edited by Sewbacca, 23 June 2016 - 12:05 PM.