I'm digging MushClient after a week.
I'm writing some Lua to log data out to a flat file and I'm running into an issue. I tried this code in a Lua IDE locally and it worked, in MushClient I get an error. In the IDE I set trigger text to something random.
The trigger returns %0 correctly as I want, the io.open tosses an error though which is also below.
Although not mentioned in the error, I have trusted all world in the global settings I have permissions to the folder in question. I've also tried the other append/write modes.
Any thoughts on what I'm missing?
Edit, but will leave for posterity -->
Got it working with this... The odd formatting of the file in the error seemed like it wasn't reading the escapes right.. went from 2 per slash to 4.. and it worked. I'm not sure why it needs 4, but it worked after.
I'm writing some Lua to log data out to a flat file and I'm running into an issue. I tried this code in a Lua IDE locally and it worked, in MushClient I get an error. In the IDE I set trigger text to something random.
The trigger returns %0 correctly as I want, the io.open tosses an error though which is also below.
local triggerText = "%0"
file = assert(io.open("C:\\Temp\\test.txt", "a"))
io.output(file)
io.write(os.date("%m/%d/%Y "))
io.write(triggerText)
io.close(file)
Run-time error
World: Mud
Immediate execution
[string "Trigger: "]:2: C:Temp est.txt: Invalid argument
stack traceback:
[C]: in function 'assert'
[string "Trigger: "]:2: in main chunk
Although not mentioned in the error, I have trusted all world in the global settings I have permissions to the folder in question. I've also tried the other append/write modes.
Any thoughts on what I'm missing?
Edit, but will leave for posterity -->
Got it working with this... The odd formatting of the file in the error seemed like it wasn't reading the escapes right.. went from 2 per slash to 4.. and it worked. I'm not sure why it needs 4, but it worked after.
file = assert(io.open("C:\\\\Temp\\\\test.txt", "a"))