Reputation: 464
So I'm using luac to compile some .lua
into .lub
recursively through a batch file.
I'm also having an issue that the output of the luac (same name as the .lua
, but with .lub
extension) is not going to the folder where the .lua
was found.
I've used:
for /r %%r in (*.lua) do luac5.1.4.exe -o "%%~nr.lub" "%%r"
and the .lub
of a .lua
in a deeper folder is outputted in the root folder.
What should I change in the script so it outputs inside the .lua
's location folder?
Upvotes: 1
Views: 605
Reputation: 464
I solved this situation simply altering the end of the script. It now looks like this:
for /r %%r in (*.lua) do "luac5.1.4.exe" -o "%%~pnr.lub" "%%r"
Now the batch will output to %%~pnr
, which serves as the file name and its path, excluding the extension, so I could add the .lua
at the end, solving this little issue.
Upvotes: 1