Skip to content

Commit e8fd0ab

Browse files
Sunrisepeakclaude
andcommitted
add mcpplibs-capi-lua library
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9c71be1 commit e8fd0ab

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

packages/l/lua/xmake.lua

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package("mcpplibs-capi-lua")
2+
3+
set_homepage("https://github.com/mcpplibs/lua")
4+
set_description("C++23 module bindings for Lua 5.4 C API")
5+
set_license("Apache-2.0")
6+
7+
add_urls(
8+
"https://github.com/mcpplibs/lua/archive/refs/tags/$(version).tar.gz",
9+
"https://github.com/mcpplibs/lua.git"
10+
)
11+
12+
add_versions("0.0.1", "cd75cf95f193e782c9024e25a89fce99c820dc93930d7157a16f89f5a16b6521")
13+
14+
add_deps("lua")
15+
16+
on_install(function (package)
17+
import("package.tools.xmake").install(package)
18+
end)

tests/l/lua/main.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import std;
2+
import mcpplibs.capi.lua;
3+
4+
int main() {
5+
auto L = lua::L_newstate();
6+
lua::L_openlibs(L);
7+
8+
lua::L_dostring(L, "result = 6 * 7");
9+
lua::getglobal(L, "result");
10+
auto result = lua::tointeger(L, -1);
11+
std::println("6 * 7 = {}", result);
12+
13+
lua::close(L);
14+
return 0;
15+
}

tests/l/lua/xmake.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
add_repositories("mcpplibs-index https://github.com/mcpplibs/mcpplibs-index.git")
2+
3+
add_requires("mcpplibs-capi-lua 0.0.1")
4+
5+
target("lua_test")
6+
set_kind("binary")
7+
add_languages("c++23")
8+
add_files("main.cpp")
9+
add_packages("mcpplibs-capi-lua")
10+
set_policy("build.c++.modules", true)

0 commit comments

Comments
 (0)