aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcompile_lib.sh12
-rw-r--r--consolecolors.lua4
-rw-r--r--utils.lua3
3 files changed, 14 insertions, 5 deletions
diff --git a/compile_lib.sh b/compile_lib.sh
index 27be682..802fcf0 100755
--- a/compile_lib.sh
+++ b/compile_lib.sh
@@ -1,4 +1,6 @@
#!/bin/sh
+# This file is a script that converts the .nom files in lib/ into slightly more optimized
+# precompiled versions that are only lua> ".." and =lua ".." bits which are faster to load.
FLUSH=false
while getopts ":f" opt; do
case $opt in
@@ -9,15 +11,15 @@ while getopts ":f" opt; do
esac
done
if [ "$FLUSH" = true ] ; then
- for file in $(find lib/ -name "*.nom.lua") ; do
+ for file in $(find lib/ -name "*compiled.nom") ; do
rm $file
done
fi
-for file in $(cat compile_order.txt) ; do
- luafile="$file.lua"
- if [ ! -e "$luafile" ] || [ "$file" -nt "$luafile" ] ; then
- echo "Compiling $file into $luafile"
+for file in $(cat lib/core.nom | lua -e "for filename in io.read('*a'):gmatch('require \"([^\"]*)\"') do print(filename) end") ; do
+ compilefile="${file/\.nom/.compiled.nom}"
+ if [ ! -e "$compilefile" ] || [ "$file" -nt "$compilefile" ] ; then
+ echo "Compiling $file into $compilefile"
./nomsu.moon -c $file
fi
done
diff --git a/consolecolors.lua b/consolecolors.lua
index 7b87c0b..650bc81 100644
--- a/consolecolors.lua
+++ b/consolecolors.lua
@@ -1,3 +1,7 @@
+--
+-- This file contains the ANSI escapes for console colors
+--
+
local colors = {
-- attributes
reset = 0,
diff --git a/utils.lua b/utils.lua
index 46e82f8..111f25c 100644
--- a/utils.lua
+++ b/utils.lua
@@ -1,3 +1,6 @@
+--
+-- A collection of helper utility functions
+--
local function is_list(t)
if type(t) ~= 'table' then