File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ members = [
1818 " tests/examples/catch2-main" ,
1919 " tests/examples/catch2-v2" ,
2020 " tests/examples/catch2-v2-main" ,
21+ " tests/examples/capi-lua" ,
2122 " tests/examples/cjson" ,
2223 " tests/examples/cmdline" ,
2324 " tests/examples/cli11" ,
Original file line number Diff line number Diff line change 1- -- Form A descriptor: the upstream repo ships its own mcpp.toml from
2- -- 0.0.3 onwards, so we omit the `mcpp` field — mcpp default-look-up
3- -- finds <verdir>/lua-<tag>/mcpp.toml inside the GitHub tarball wrap.
1+ -- Form B descriptor for the immutable 0.0.3 payload. Its upstream
2+ -- mcpp.toml predates exact package selectors and declares bare `lua`, which
3+ -- now means `(mcpplibs, lua)` and cannot identify the real C library at
4+ -- `(compat, lua)`. Keep the release bytes unchanged and carry the canonical
5+ -- dependency here until a newer upstream release can return to Form A.
46package = {
57 spec = " 1" ,
68 namespace = " mcpplibs.capi" ,
@@ -39,4 +41,18 @@ package = {
3941 },
4042 },
4143 },
44+
45+ mcpp = {
46+ schema = " 0.1" ,
47+ language = " c++23" ,
48+ import_std = false ,
49+ modules = { " mcpplibs.capi.lua" },
50+ include_dirs = { " */src/capi" },
51+ sources = {
52+ " */src/capi/lua.cppm" ,
53+ " */src/capi/lua.cpp" ,
54+ },
55+ targets = { [" capi-lua" ] = { kind = " lib" } },
56+ deps = { [" compat.lua" ] = " 5.4.7" },
57+ },
4258}
Original file line number Diff line number Diff line change 1+ [indices ]
2+ "mcpplibs.capi" = { path = " ../../.." }
3+
4+ [package ]
5+ name = " capi-lua-tests"
6+ version = " 0.1.0"
7+
8+ [dependencies .mcpplibs ]
9+ capi.lua = " 0.0.3"
Original file line number Diff line number Diff line change 1+ import mcpplibs.capi.lua;
2+
3+ namespace lua = mcpplibs::capi::lua;
4+
5+ int main () {
6+ auto * state = lua::L_newstate ();
7+ if (state == nullptr ) return 1 ;
8+
9+ const int status = lua::L_dostring (state, " return 6 * 7" );
10+ const auto answer = lua::tointeger (state, -1 );
11+ lua::close (state);
12+ return status == lua::OK && answer == 42 ? 0 : 1 ;
13+ }
You can’t perform that action at this time.
0 commit comments