CougarFFW04 发布于2024年2月29日 发布于2024年2月29日 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 发布于2024年2月29日 发布于2024年2月29日 Is it maybe treating \t as an escape character? Maybe try using / in your file path instead?Zyll @ TAW
解答 cfrag 发布于2024年3月1日 解答 发布于2024年3月1日 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 发布于2024年3月1日 楼主 发布于2024年3月1日 Hy Guys, In fact it was both... io was 'sanitized' and one must use \\ instead of \ in the path. Thanks
已推荐帖子