mudgangster

Log | Files | Refs

commit 65303eb259a2441bd3d86a9c7b3841a1ab5f1e71
parent 746c65470bcc6ea0b71a9739ceee5d99d897c1a2
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Tue,  4 Sep 2018 11:12:15 +0300

Use a lua script instead of xxd to convert bytecode to a C array

Diffstat:
scripts/bin2arr.lua | 8++++++++
scripts/pack_lua.sh | 2+-
2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/scripts/bin2arr.lua b/scripts/bin2arr.lua @@ -0,0 +1,8 @@ +local i = 0 +for c in io.stdin:lines( 1 ) do + if i > 0 and i % 16 == 0 then + print() + end + i = i + 1 + io.stdout:write( string.byte( c ) .. "," ) +end diff --git a/scripts/pack_lua.sh b/scripts/pack_lua.sh @@ -3,4 +3,4 @@ set -o pipefail mkdir -p build -exec lua scripts/merge.lua src/lua main.lua | luac -o - - | xxd -i > build/lua_bytecode.h +exec lua scripts/merge.lua src/lua main.lua | luac -o - - | lua scripts/bin2arr.lua > build/lua_bytecode.h