Skip to content

SuSonicTH/zli

Repository files navigation

ZLI - Zig Lua Interpreter

ZLI is a portable lua interpreter statically compiled (on non windows with musl) with additional libraries. The binary can be moved from system to system without any dependencies on installed ibraries.

Currently supported platforms

  • Windows on x86_64
  • linux on x86_64
  • linux on aarch64

Other platforms that are supported by zig could work but are untested.

Examples:

  • Windows on x86 and aarch64
  • linux on x86, armv7a, riscv64 and powerpc64le
  • macOS on aarch64 and x86_64

Batteries included

There are many libraries included in the ZLI binary, some 3rd party lua libraries and some developed specifically for ZLI.

included lua libraries

3rd party lua libraries included in ZLI

library link licence description
argparse https://github.com/mpeterv/argparse MIT Argparse is a feature-rich command line parser for Lua inspired by argparse for Python
f-string https://github.com/hishamhm/f-strings MIT String interpolation for Lua, inspired by f-strings, a form of string interpolation coming in Python 3.6.
ftcsv https://github.com/FourierTransformer/ftcsv MIT ftcsv is a fast csv library written in pure Lua
LPeg https://www.inf.puc-rio.br/~roberto/lpeg/ MIT LPeg is a new pattern-matching library for Lua, based on Parsing Expression Grammars (PEGs)
lua-cjson https://github.com/openresty/lua-cjson MIT Fast JSON encoding/parsing
lua-zlib https://github.com/brimworks/lua-zlib MIT lua binding to the zlib to compress/decompress
LuaSQLite3 http://lua.sqlite.org/ MIT LuaSQLite 3 is a thin wrapper around the public domain SQLite3 database engine.
luaunit https://github.com/bluebird75/luaunit BSD LuaUnit is a popular unit-testing framework for Lua, with an interface typical of xUnit libraries (Python unittest, Junit, NUnit, ...)
Serpent https://github.com/pkulchenko/serpent MIT Lua serializer and pretty printer.

Custom ZLI bindings to 3rd party libraries

there are some custom lua bindings for 3rd party libraries

library link licence description
Crossline https://github.com/jcwangxp/Crossline MIT Crossline is a small, self-contained, zero-config, MIT licensed, cross-platform, readline and libedit replacement.
unzip / zip https://zlib.net/ MIT binding to the minizip library included in zlib for zip file handling

Inhouse ZLI libraries

libraries developed specifically for ZLI that don't use any external libraries

library description
auxiliary some auxiliary functions to improve the string, table and file handling
benchmark a small library to run benchmarks with nano second precision
collection a collection library simmilar to java's collection. (Hash)Set, (Hash)map and (Array)list are implemented
filesystem providing filesystem functions like listing/creating/changing directories, deleting/renaming/moving files & directories
grid a library to output line-drawing text grids (tables) with per column alignment,padding, min/max width
httpclient a convinient httpclient library based on zig's httpclient, supports get,post,put,patch,delete with many options
httpserver a convinient httpserver library based on zig's httpcserver, includes optional caching
logger a very simple logging library
luastrip a lua source code stripping/compacting library to remove comments and unnessessary whitespace from lua source code
memoize a library to memoize/cache expensive function results
stream a stream library enspired by the java stream library that brings the functional style programming to lua
timer a nanosecond timer for high precision timings available as os.nanotime
uuid a library to create V4 and v7 uuids in string form
xlsxmlwriter a very simple library to write an excel file in the xml format. Not space efficient nor feature rich but simple and fast

Included tools

In the main binary there are also some commandline tools embedded.

commandline option description
--compiler a tool to package lua scripts and files into a zip attached to an executable (alpha)
--repl a Read Print Eval Loop with a nice interface
--sqlite a sqlite interface. open, query and manipulate any sqlite database

Build

The build works under linux and windows(under gitbash) for x86_64 platforms and on linux arm. All it needs git and zig version 0.16.0 on the path

git clone https://github.com/SuSonicTH/zli.git
cd zli
./build.sh

If you want to compile for all the supported platforms use the --all switch, all binaries are saved to the bin directory with the platform suffix.

./build.sh --all

If you want to have a substentially smaller binary (as the release binaries) you also have to have upx on the path and call:

./build.sh --upx

Tests can be executed by calling

./build.shj --test

About

Portable statically linked lua interpreter

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors