Skip to content

Instantly share code, notes, and snippets.

@ZwerOxotnik
Created December 12, 2021 14:43
Show Gist options
  • Save ZwerOxotnik/f7e88bb226f1e36ec5d52367ee197b0f to your computer and use it in GitHub Desktop.
Save ZwerOxotnik/f7e88bb226f1e36ec5d52367ee197b0f to your computer and use it in GitHub Desktop.
lua2p (bash script + vscode task)
#!/bin/bash
### Compile *.lua2p files to *.lua files and format them
### https://github.com/ReFreezed/LuaPreprocess
use_cmd=0
case "$OSTYPE" in
win32|cygwin|msys) use_cmd=1 ;;
esac
parameters=$1
format=*.lua2p
files=($(find . -name "$format" -type f))
for path in "${files[@]}";
do
if [[ "$path" == "$format" ]]
then
echo "No Files"
else
if [ $use_cmd -eq 1 ]; then
Preprocess.cmd $parameters $path
else
lua preprocess-cl.lua $parameters $path
fi
fi
done
{
"version": "2.0.0",
"tasks": [
{
"label": "lua2p to Lua [debug]",
"type": "shell",
"problemMatcher": [],
"command": "bash",
"args": [".scripts/lua2p.sh.sh", "--debug"],
"group": "build"
},
{
"label": "lua2p to Lua [release]",
"type": "shell",
"problemMatcher": [],
"command": "bash",
"args": [".scripts/lua2p.sh.sh", "--release"],
"group": "build"
},
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment