mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-16 01:11:28 +00:00
e402467676
Also, in listglobals.sh, check for file existence. git-svn-id: https://svn.eduke32.com/eduke32@4044 1a8010ca-5511-0410-912e-c29ae57300e0
35 lines
843 B
Bash
Executable file
35 lines
843 B
Bash
Executable file
#!/bin/sh
|
|
|
|
if [ -z "$1" ]; then
|
|
# S or G can be used to display SETGLOBALs or GETGLOBALs, respectively
|
|
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
|
|
|
|
for f in "$@"; do
|
|
if [ ! -f "$f" ]; then
|
|
echo "$f: No such file"
|
|
exit 2
|
|
fi
|
|
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
|