1
0
mirror of https://github.com/Adorable-Catgirl/LuaComp.git synced 2024-11-17 07:28:05 +11:00
LuaComp/README.md

41 lines
636 B
Markdown
Raw Normal View History

2019-11-05 15:42:50 +11:00
# LuaComp
2019-12-15 09:16:32 +11:00
A general purpose preprocessor and postprocessor written in Lua.
2019-11-06 06:47:42 +11:00
## Building
2019-12-15 09:16:32 +11:00
See manual/README.md
2019-11-06 07:26:41 +11:00
## How-To
2019-12-15 09:16:32 +11:00
### Merging source files
2019-11-06 07:26:41 +11:00
```lua
-- myfile.lua
local my_lib = {}
function my_lib.hello_world()
print("Hello, world!")
end
```
```lua
-- main.lua
--#include "my_file.lua"
my_lib.hello_world()
```
### Getting enviroment variables
```lua
print("This was compiled in the shell "..$(SHELL))
```
### Macros
```lua
@[[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)]]
```