Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: thespindoctor on April 25, 2018, 05:23:01 PM
-
I cannot get Lua to write to an empty file. I create the file nicely and if I put a character on the first line then the write command works fine
If I create a file which is empty, then the commands do not work.
Anyone have this problem?
THanks
-
Hi,
I think you have to open the file, then flush() and then close() before the file will stick even though
its empty.
Craig
-
That is whatI am doing but the strange thing is it works only when there is at least one character on rhe first line.
I have tried all kinds of manipulations. Everything works as expected with a file that is not empty.
Nothing works on an empty file...
-
Could be an issue since i first open the file to read it then check to find a zero length. Then close it and reopen it for writing
-
Working now. I just simplified the variables and it is working. I had been saving the file name from a variable into an easier variable. Leaving it in the first variable worked.
-
Hi,
maybe a file has to have one character...an EOF character?
Craig
-
No it works fine now. I had another script running that created a global variable for path and file but then I stored that file name in a local variable. This caused the issue. When I use the global variable, it works fine!
-
What exactly are you trying to do here? Write to a file?
You've struck my curiosity haha.
-
Just a simple one line write to a file!