You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
589 B
27 lines
589 B
const std = @import("std");
|
|
const testing = std.testing;
|
|
|
|
pub const c = @cImport({
|
|
@cInclude("lua.h");
|
|
@cInclude("lualib.h");
|
|
@cInclude("lauxlib.h");
|
|
@cInclude("luajit.h");
|
|
});
|
|
|
|
export fn add(a: i32, b: i32) i32 {
|
|
return a + b;
|
|
}
|
|
|
|
test "basic functionality" {
|
|
const script =
|
|
\\print("hello from luajit :)\n")
|
|
\\io.flush()
|
|
;
|
|
const L = c.luaL_newstate();
|
|
c.luaL_openlibs(L);
|
|
_ = c.luaL_loadstring(L, @as([*c]const u8, @ptrCast(script)));
|
|
_ = c.lua_pcall(L, 0, c.LUA_MULTRET, 0);
|
|
c.lua_close(L);
|
|
|
|
std.log.warn("hi", .{});
|
|
}
|
|
|