CougarFFW04 Posted February 29, 2024 Posted February 29, 2024 Hi everyone, I would like to write a file within a DCS script with the following : -- Opens a file in read file = io.open("G:\test.lua", "w") file:write("TOTO\n") -- closes the open file io.close(file) But I get an error accesing a nil value... Howerver G is an valid USB key... What's going on ? Thanks ?
Zyll Posted February 29, 2024 Posted February 29, 2024 Is it maybe treating \t as an escape character? Maybe try using / in your file path instead?Zyll @ TAW
Solution cfrag Posted March 1, 2024 Solution Posted March 1, 2024 14 hours ago, CougarFFW04 said: I get an error accesing a nil value... Have you de-sanitized your DCS installation? By default, the modules lfs, io and os are 'sanitized', i.e. set to nil. That may be where you get the nil error from. It would of course help if you posted the error message and location where the error happened.
CougarFFW04 Posted March 1, 2024 Author Posted March 1, 2024 Hy Guys, In fact it was both... io was 'sanitized' and one must use \\ instead of \ in the path. Thanks
Recommended Posts