The value is stored in the global variable
output_directory in the C source file, unfortunately it's not exported to Lua.
I thought it would be possible to do something like
kpse.find_file("a.log") but that doesn't work despite claims that it should work.
One workaround (ugly but works) I can find is to use
open_read_file callback, write to some tempfile (using simply jobname.log works as well without the temporary file, but not sure about MiKTeX), then read from it, and get the file name from the argument passed to the file.
Alternative includes reading the recorder file, similar to the method for other engines, but requires -recorder flag and it's impossible to determine the case where one compilation has the flag and the next compilation doesn't.
Side note, only the
arg table is guaranteed to work, but parsing this is very difficult. Possible argument format includes
so very hard to parse.
arguments table seems to be some global variable leakage in older version, nowadays it can only be found in e.g.
luaotfload.fontloader.arguments, but then this one only handle some formats of the above list, so not reliable.
utilities.parsers.arguments_to_table but I guess this suffers from the same limitation.