Launching Lua
-
Okay so I have made a new Name.Lua file, and put the correct directory for Lua.exe in the launch command.
I also tried clarifying cmd /c and /k.I can not get NPP to open CMD, and auto paste/run the code.
It will open CMD and not paste anything, meaning every time I want to run I have to copy and paste the whole thing by hand.
I even tried making a .bat file to open Lua.exe and did not work.
I copied videos exactly, still nothing.
I get error code 2: cannot find file specified, and it shows me both directories for Lua and CURRENT_FILE_PATH so I don’t know how it can’t find them.I am noob to NPP just trying to set it up.
-
I get error code 2: cannot find file specified, and it shows me both directories for Lua and CURRENT_FILE_PATH so I don’t know how it can’t find them.
$(CURRENT_FILE_PATH) is not listed in the special run-command variables in the user manual.
I can not get NPP to open CMD, and auto paste/run the code
It does not “auto paste”. You have to give the Run… command an argument to tell it exactly what you want to run.
Run > Run… >
should properly run the active file name using lua.exe (or usecmd /c "c:\path with spaces\to\lua.exe" "$(FULL_CURRENT_NAME)"
cmd /k
if you want it to keep the cmd window open)If you could show some of the example Run lines you have tried, I might be able to further explain why those weren’t sufficient, if I haven’t already explained it to your satisfaction.
—
edit:See Also
We have a FAQ on how to run the active file through a compiler (which works equally well for an interpreter; that’s how I have Notepad++ set up to run the perl programs that I write).
–
edit 2: FULL_CURRENT_NAME is wrong; see later post below for correction -
I already tried that, it just opens CMD and gives me C:Program files/Notepad++>
with the > symbol on end but nothing more, or it closes instantly.
-
You need to give me something. Copy/paste the exact commands you are using; use Alt+PrintScreen to show the command window. Something.
Because if you have a valid path to lua, if you use quotes the way I showed, and if the normal way to run a lua script from the command line is
lua.exe scriptname.lua
, then the example I showed should have worked. -
@PeterJones said in Launching Lua:
cmd /c "c:\path with spaces\to\lua.exe" "$(FULL_CURRENT_NAME)"
Ugh. I meant
cmd /c "c:\path with spaces\to\lua.exe" "$(FULL_CURRENT_PATH)"
– don’t know how I got that wrong, since I’d provided the link to the full list of valid variables and everything. :-( -
@PeterJones said in Launching Lua:
$(FULL_CURRENT_PATH)
I never remember this kind of stuff, so…
I have a Run menu command – saved as
NPP $(XXX) vars echo (file info)
– that gives me an example when I need it:cmd /c echo FULL_CURRENT_PATH=$(FULL_CURRENT_PATH) CURRENT_DIRECTORY=$(CURRENT_DIRECTORY) FILE_NAME=$(FILE_NAME) NAME_PART=$(NAME_PART) EXT_PART=$(EXT_PART) && pause
Sample output:
After running, I can copy the
FULL_CURRENT_PATH
– or whatever text – from the cmd window, so not only do I NOT have to remember the names, I never have to type them either.Later edit:
However, I can’t actually echo the verbatim text
$(FULL_CURRENT_PATH)
to the cmd window, because Notepad++ will hijack that and replace it. This could be “fixed” (see https://github.com/notepad-plus-plus/notepad-plus-plus/issues/9567) but perhaps doubtful that it ever will be.