Thread Tools Display Modes
09-15-12, 04:16 AM   #1
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
FindGlobals, Lua 5.2, NppExec and pipe char

I didn't want to derail this thread, and I have some questions about FindGlobals concerning Lua 5.2 and NppExec
  1. Why does this cmd script give an empty output with Lua 5.2? But it still seems to work for Lua 5.1
    cmd Code:
    1. luac52 -l -p MyFile.lua | lua52 globals.lua MyFile.lua

  2. Why doesn't NppExec support the pipe char | ? Or do I need to escape it or something in NppExec?

    This works fine in the Windows command line ...
    cmd Code:
    1. luac51 -l -p MyFile.lua | lua51 globals.lua MyFile.lua

    ... but this won't work in NppExec ...
    nppexec Code:
    1. luac51 -l -p "$(FULL_CURRENT_PATH)" | lua51 "D:\FindGlobals\globals.lua" "$(FULL_CURRENT_PATH)"

    ... and the NppExec console gives the following error:
    Code:
    luac51 -l -p "D:\World of Warcraft\Interface\AddOns\ScrollingChatText\ScrollingChatText.lua" | lua51 "D:\FindGlobals\globals.lua" "D:\World of Warcraft\Interface\AddOns\ScrollingChatText\ScrollingChatText.lua"
    Process started >>>
    luac51: cannot open |: Invalid argument
    <<< Process finished.

Notes:
  • Shortened the cmd directory paths for readability
  • lua-5.2.1_Win64_bin and lua5_1_4_Win64_bin paths added to Windows environmental variables
  Reply With Quote
09-15-12, 06:45 AM   #2
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
I've never dealt with Lua 5.2 nor NPPExec, so no idea...:/
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
09-15-12, 12:13 PM   #3
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Just to be clear to anyone reading this, WoW doesn't use Lua 5.2. It's on 5.1.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
09-15-12, 12:44 PM   #4
cremor
A Murloc Raider
Join Date: Jun 2008
Posts: 9
No idea about Lua 5.2 but I'm using NppExec as explained in the comments here: http://www.wowace.com/addons/findglobals/
  Reply With Quote
09-15-12, 02:28 PM   #5
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
Originally Posted by cremor View Post
No idea about Lua 5.2 but I'm using NppExec as explained in the comments here: http://www.wowace.com/addons/findglobals/
I followed your advice and am doing it from the .bat now and referring to it from NppExec, and it works now!

Really curious why it doesn't work straight from NppExec though ..

For reference (for myself):
nppexec Code:
  1. "D:\FindGlobals\globals.bat" "$(FULL_CURRENT_PATH)"
bat Code:
  1. luac51 -l -p %1 | lua51 "D:\FindGlobals\globals.lua" %1
  Reply With Quote
07-20-14, 08:12 AM   #6
tanz2014
A Kobold Labourer
Join Date: Jul 2014
Posts: 1
Originally Posted by Ketho View Post
I followed your advice and am doing it from the .bat now and referring to it from NppExec, and it works now!

Really curious why it doesn't work straight from NppExec though ..

For reference (for myself):
nppexec Code:
  1. "D:\FindGlobals\globals.bat" "$(FULL_CURRENT_PATH)"
bat Code:
  1. luac51 -l -p %1 | lua51 "D:\FindGlobals\globals.lua" %1
I know this thread is old, but just wanted to satisfy the curiosity ...

The functionality of the pipe operator (which is to redirect the standard output of the left-hand-side command as the standard input of the right-hand-side command) is supported by the Windows Command Shell (cmd.exe), not by NppExec. So if you do it from the .bat file it works because the .bat file is run by cmd.exe.

Alternatively you could have done the following from within NppExec:
Code:
cmd /c luac51 -l -p "$(FULL_CURRENT_PATH)" | lua51 "D:\FindGlobals\globals.lua" "$(FULL_CURRENT_PATH)"
which would start a cmd.exe with the rest of the command line, so the pipe would still work as expected.
  Reply With Quote
07-20-14, 09:50 AM   #7
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
Thanks very much for the explanation and example, tanz2014 (and still satisfying my curiosity)

I also noticed that in my case I renamed my "lua5.1.exe" windows binary to "lua51.exe", I got annoyed by the dot I think. Just a friendly notice for others copypasting this...
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » FindGlobals, Lua 5.2, NppExec and pipe char


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off