2023-02-21 21:42:55 +01:00
|
|
|
//! Module for compiling lua files using luajit
|
|
|
|
//! and mzte-nv-compiler.
|
2022-11-19 01:53:49 +01:00
|
|
|
const std = @import("std");
|
|
|
|
const ser = @import("../ser.zig");
|
|
|
|
const ffi = @import("../ffi.zig");
|
|
|
|
const c = ffi.c;
|
|
|
|
const compiler = @import("../compiler.zig");
|
|
|
|
|
|
|
|
pub fn luaPush(l: *c.lua_State) void {
|
|
|
|
ser.luaPushAny(l, .{
|
|
|
|
.compilePath = ffi.luaFunc(lCompilePath),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
fn lCompilePath(l: *c.lua_State) !c_int {
|
2023-02-23 10:56:20 +01:00
|
|
|
const path = ffi.luaCheckstring(l, 1);
|
|
|
|
try compiler.doCompile(path, std.heap.c_allocator);
|
2022-11-19 01:53:49 +01:00
|
|
|
return 0;
|
|
|
|
}
|