2012-12-09 13:24:28 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
# S or G can be used to display SETGLOBALs or GETGLOBALs, respectively
|
|
|
|
echo "Usage: $0 <file.lua> [S|G]"
|
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
|
2013-04-05 17:53:21 +00:00
|
|
|
# Lua 5.2 required to parse ::label:: / goto generated by LunaCON.
|
|
|
|
LUAC=luac
|
|
|
|
|
2012-12-09 13:24:28 +00:00
|
|
|
# Strip LuaJIT specific syntax
|
2013-04-05 17:53:21 +00:00
|
|
|
sed -r -e "s/[0-9]+U?LL/0/g" "$1" | $LUAC -p -l - | grep "$2ETTABUP.*; _ENV " |
|
2012-12-09 13:24:28 +00:00
|
|
|
# mark where the new module environment starts
|
|
|
|
sed -e "s/; module/; module ____________________/"
|