mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
lunatic/listglobals.sh: allow passing multiple file names.
git-svn-id: https://svn.eduke32.com/eduke32@3915 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
fb0c13f9f2
commit
16f2f4c475
1 changed files with 21 additions and 7 deletions
|
@ -2,16 +2,30 @@
|
|||
|
||||
if [ -z "$1" ]; then
|
||||
# S or G can be used to display SETGLOBALs or GETGLOBALs, respectively
|
||||
echo "Usage: $0 <file.lua> [S|G]"
|
||||
echo "Usage: $0 [S|G] <files.lua...>"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
GS=
|
||||
|
||||
if [ "$1" = G ]; then
|
||||
GS=G
|
||||
shift
|
||||
elif [ "$1" = S ]; then
|
||||
GS=S
|
||||
shift
|
||||
fi
|
||||
|
||||
# Lua 5.2 required to parse ::label:: / goto generated by LunaCON.
|
||||
LUAC=luac
|
||||
|
||||
# Strip LuaJIT specific syntax first. Run luac and extract interesting lines.
|
||||
sed -r -e "s/[0-9]+U?LL/0/g" "$1" | $LUAC -p -l - | grep "$2ETTABUP.*; _ENV " |
|
||||
# Reformat them.
|
||||
sed -e 's/.*\[\(.*\)\].*\([SG]ET\)TABUP.*"\(.*\)".*/\1: \2 \3/' |
|
||||
# Mark where the new module environment starts.
|
||||
sed -e 's/GET module/& ____________________/'
|
||||
for f in "$@"; do
|
||||
echo "[$f]"
|
||||
# Strip LuaJIT specific syntax first. Run luac and extract interesting lines.
|
||||
sed -r -e "s/[0-9]+U?LL/0/g" "$f" | $LUAC -p -l - | grep "${GS}ETTABUP.*; _ENV " |
|
||||
# Reformat them.
|
||||
sed -e 's/.*\[\(.*\)\].*\([SG]ET\)TABUP.*"\(.*\)".*/\1: \2 \3/' |
|
||||
# Mark where the new module environment starts.
|
||||
sed -e 's/GET module/& ____________________/'
|
||||
echo
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue