Improved README.md
This commit is contained in:
parent
a28b585cd4
commit
196b56935c
2 changed files with 32 additions and 1 deletions
31
README.md
31
README.md
|
|
@ -1,3 +1,34 @@
|
|||
**Simple**
|
||||
```zig
|
||||
// --- ZLA ---
|
||||
var zla: Zla = try .init();
|
||||
defer zla.deinit();
|
||||
|
||||
// --- EXEC FILE ---
|
||||
try zla.execFromFile(
|
||||
void,
|
||||
"src/scripts/basic.lua",
|
||||
);
|
||||
|
||||
// --- CALL ---
|
||||
try zla.call(void, "hello", .{"World"});
|
||||
try zla.call(void, "hello", .{"..."});
|
||||
```
|
||||
|
||||
**Call function from lua**
|
||||
```zig
|
||||
try zla.call(void, "hello", .{"World"});
|
||||
```
|
||||
|
||||
**Call function from lua with return type**
|
||||
```zig
|
||||
const coords = try zl.call(
|
||||
struct { f64, f64 },
|
||||
"getCoords",
|
||||
.{},
|
||||
);
|
||||
```
|
||||
|
||||
**Dependancies**
|
||||
```bash
|
||||
sudo pacman -Sy lua --needed
|
||||
|
|
|
|||
|
|
@ -368,7 +368,7 @@ fn increment(ctx: *Ctx) i64 {
|
|||
|
||||
test "exec" {
|
||||
// --- ZLA ---
|
||||
var zl = try Self.init();
|
||||
var zl: Self = try .init();
|
||||
defer zl.deinit();
|
||||
|
||||
// --- REGISTER FUNCTIONS TO LUA ---
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue