I apologize in advance for the length of this. I've been attempting to solve this problem myself and in order to avoid a lot of "but have you tried this" responses, I want to walk through everything I've done.
I had to rebuild my PC's hard drive and I've completely forgotten how to set up NppExec to run Lua code for me. I'm trying to reinvent something I know I had working before and I'm running into trouble with it.
Runtime Environment Description
64-bit Notepad++ version 7.5.6 from a fresh download (today).
NppExec from SourceForge, NppExec20160628_dll_x64-2.zip
I appended my runtime directory to the PATH environmental variable and tested that this worked by opening a cmd window and typing just lua53.exe. The lua runtime window opened right up.
I closed that cmd window.
I opened Notepad++ and invoked NppExec with this command set:
I used /K instead of /C to help me track down where the problem is - normally those would both be /C.
The results I got from that are that the console window flashed open and closed and a cmd window popped up with a title line that says exactly this:
C:\Windows\System32\cmd.exe - cmd /K "lua53.exe" "F:\MyProjectFolder\TestCode\Test Code.lua"
The first part is, indeed, my lua executable name and the second part is, indeed the full path name and file name for the window that was current when I invoked the command set through NppExec.
The filename, directory name, or volume label syntax is incorrect.
D:\Programs\Notepad++>
I tried isolating where the problem might be by running it this way (I removed the reference to what the interpreter was to interpret):
It ran and dumped the output to the cmd window and the output was exactly what I would have expected from a successful run.
It feels like the FULL_CURRENT_PATH variable isn't being set accurately, but that can't be true because the window title in the first run had the exactly correct path-and-file name (including the necessary double-quotes).
Obviously, I've got something subtle wrong with this, but I don't know NppExec's interface well enough to spot it.
Is there anyone out ther who can or has any idea of what else I should try to narrow in on the problem?
Last edit: Mark Louis Tinney 2018-04-01
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Any reason why so ancient version of NppExec is used? Currently the version 0.6 beta 1 is highly recommended.
As for starting Lua, these two examples work for me, depending on what exactly you want to achieve:
//LuainNppExec'sConsoleset local Lua = C:\Lua\bin\lua.exe // specifyyourpathtoLuaherenpp_save"$(Lua)""$(FULL_CURRENT_PATH)"
and
//Luainaseparateconsolewindowset local Lua = C:\Lua\bin\lua.exe // specifyyourpathtoLuaherenpp_savenpp_runcmd/c""$(Lua)" "$(FULL_CURRENT_PATH)" && pause"
Last edit: DV 2018-04-02
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As to the "ancient" version, I pulled the most current "stable" (so claimed) version of NPPExec 64 available. A recently released beta is still not what I would normally call "stable".
I did, however download and install it and had no change in the results.
I"m going to try your command samples and see if I get better results.
What was using before (when this worked) looked a lot like what I'm using now. I did the same sort of queries to find it and I copied it verbatim (except that I put my path-to-lua in my system PATH variable to simplify manual use of the run-time environment.
I want it to kick the results back to me in the NPPExec Console rather than in a CMD window.
I'll give that code a shot and see what happens.
As an aside, I was under the impression that I'd get email notifications to posts and didn't check back right away.
I've had a moment to paste in your command segment and it works just fine.
Thanks!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The message "could not save the file" is a red herring here - in fact its meaning is "the file is not modified, so it can not be saved since there is nothing to save". There will be more correct behavior in the next version of NppExec.
As for absent output, I can only say that e.g. print("123") works as expected.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I apologize in advance for the length of this. I've been attempting to solve this problem myself and in order to avoid a lot of "but have you tried this" responses, I want to walk through everything I've done.
I had to rebuild my PC's hard drive and I've completely forgotten how to set up NppExec to run Lua code for me. I'm trying to reinvent something I know I had working before and I'm running into trouble with it.
Runtime Environment Description
Actions Taken and Results Obtained
It feels like the FULL_CURRENT_PATH variable isn't being set accurately, but that can't be true because the window title in the first run had the exactly correct path-and-file name (including the necessary double-quotes).
Obviously, I've got something subtle wrong with this, but I don't know NppExec's interface well enough to spot it.
Is there anyone out ther who can or has any idea of what else I should try to narrow in on the problem?
Last edit: Mark Louis Tinney 2018-04-01
Any reason why so ancient version of NppExec is used? Currently the version 0.6 beta 1 is highly recommended.
As for starting Lua, these two examples work for me, depending on what exactly you want to achieve:
and
Last edit: DV 2018-04-02
As to the "ancient" version, I pulled the most current "stable" (so claimed) version of NPPExec 64 available. A recently released beta is still not what I would normally call "stable".
I did, however download and install it and had no change in the results.
I"m going to try your command samples and see if I get better results.
What was using before (when this worked) looked a lot like what I'm using now. I did the same sort of queries to find it and I copied it verbatim (except that I put my path-to-lua in my system PATH variable to simplify manual use of the run-time environment.
I want it to kick the results back to me in the NPPExec Console rather than in a CMD window.
I'll give that code a shot and see what happens.
As an aside, I was under the impression that I'd get email notifications to posts and didn't check back right away.
I've had a moment to paste in your command segment and it works just fine.
Thanks!
Well, let me amend this.
It worked once, with a simple "Hello world" program I was using to help me debug the problem.
When I put anything more complex in there, I consistently get an error with the NPP_SAVE part that says exactly this:
; executing NPP_SAVE
The following lines are exactly this:
"lua53.exe" "F:\TestProject\Test Code.lua"
Process started (PID=12420) >>>
<<<Process finished (PID=12420). Exit code 0.
However, the very simple diagnostic code I put in the executable does not provide print.
What would cause that "- could not save file" error?
The message "could not save the file" is a red herring here - in fact its meaning is "the file is not modified, so it can not be saved since there is nothing to save". There will be more correct behavior in the next version of NppExec.
As for absent output, I can only say that e.g.
print("123")works as expected.