# Possible to run lua script from lualatex after main compilation has been done?

Is there any way to call a lua script automatically immediately after lualatex finishes(and pass the jobname)?

Basically I need to do some post process and cannot do it within the same job so I would like to run a script immediately after if it exists and pass to the script the jobname.

-
No idea if there exists a luatex specific solution. But you can reprocess a tex document inside a compilation with a new jobname. See e.g. this example (the source was a posting in c.t.t.) mrunix.de/forums/showpost.php?p=298567&postcount=7 –  Ulrike Fischer May 14 '12 at 10:39
possible duplicate of Lualatex after pdf is generated –  Jake May 15 '12 at 14:35

I've spent all day yesterday writing a luatex script to make it easier to use `\include` (instead of commenting them out or using includeonly) and then it turns out luatex doesn't have the proper callbacks before and after the pdf output creation. One or two extra lines of code that could have been added to lualatex without any drawbacks have cost me several hours... Unfortunately I deal with this kinda stuff on a daily basis and it becomes a huge waste of time(not just with tex/latex). I'll just go back to using `%` and hope lualatex will be updated in the future to support this functionality –  Uiy May 14 '12 at 12:05
@MartinSchröder Yeah, then I go to build it and send hours trying to get it to build correctly because it won't build on my machine since I'm actually keep my stuff up to date and do not use linux. For example, I just tried to install luarocks. Guess what? When I try to install the sockets package I can't because when it tries to build it the `.sln` file is not uptodate and msbuild will not build the solution since it is too old. Which means I'll have to go figure out how to do that if I want to to use luarocks... worth it? No! Again, I got better things to do than waste more of my time. –  Uiy May 15 '12 at 7:44