pw-dev_script icon indicating copy to clipboard operation
pw-dev_script copied to clipboard

Problem with log files

Open srobert72 opened this issue 2 years ago • 0 comments

Hello,

First of all thank you for your work. I use DCS UFC and DCS Nav. I have a little problem using the pw-dev_script script with other script like DCS Bios. I have a script that writes well to its log file when used alone. But if I launch it at the same time as DCS UFC then it can no longer write to its log file.

My Export.lua file only contains:

dofile(lfs.writedir()..[[Scripts\Export-SR.lua]])
pcall(function() local pw=require('lfs');dofile(pw.writedir()..[[Scripts\pw-dev_script\ExportInit.lua]]); end,nil);

My script uses its logs like this:

ExportSR.export_file_livedata = io.open(lfs.writedir().."Logs/Export-LiveData-SR.log", "w")
ExportSR.export_file_livedata:write(string.format("aircraft: %s\n\n", ExportSR.aircraft_name))

The second line fails when using DCS UFC with error:

2022-07-02 08:31:25.895 ERROR   Lua::Config: Call error LuaExportStart:[string "C:\Users\Stephane\Saved Games\DCS\Scripts\Export-SR.lua"]:93: attempt to index field 'export_file_livedata' (a nil value)
stack traceback:
	[C]: ?
	[string "C:\Users\Stephane\Saved Games\DCS\Scripts\Export-SR.lua"]:93: in function 'LuaExportStart'
	[string "C:\Users\Stephane\Saved Games\DCS\Scripts\pw-dev_script\ExportInit.lua"]:65: in function <[string "C:\Users\Stephane\Saved Games\DCS\Scripts\pw-dev_script\ExportInit.lua"]:59>.

Do you have an idea ? Thanks

srobert72 avatar Jul 02 '22 08:07 srobert72