1
0
mirror of https://github.com/Adorable-Catgirl/LuaComp.git synced 2024-12-23 08:48:05 +11:00
Mirror of LuaComp
Go to file
2019-11-24 13:25:40 -05:00
examples Now only includes argparse if you compile src/staticinit.lua 2019-11-05 20:50:07 -05:00
src Oh yeah -x 2019-11-24 13:25:40 -05:00
.gitignore Neat, it works. I think. 2019-11-05 14:47:42 -05:00
LICENSE Update LICENSE 2019-11-04 23:43:12 -05:00
README.md Update README.md 2019-11-05 15:26:41 -05:00

LuaComp

A general purpose Lua preprocessor and minifier.

Building

To build, either execute luapreproc or luacomp on src/init.lua

luapreproc

Execute luapreproc init.lua ../luacomp.lua

luacomp

Execute luacomp init.lua -xO ../luacomp.lua

NOTE: Do not use a minifier, it breaks argparse!

How-To

Merging Lua source files

-- myfile.lua
local my_lib = {}

function my_lib.hello_world()
  print("Hello, world!")
end
-- main.lua
--#include "my_file.lua"
my_lib.hello_world()

Getting enviroment variables

print("This was compiled in the shell "..$(SHELL))

Macros

@[[function my_macro(a, b)]]
print("Hello, @[{a}]. Your lucky number is @[{b}].")
@[[end]]

@[[my_macro("world", 7)]]
@[[my_macro("user", 42)]]
@[[my_macro("Earth", 0)]]
@[[my_macro("Satna", 666)]]