MCPcopy Create free account
hub / github.com/ThePhD/sol2 / open_mylib

Function open_mylib

examples/source/require.cpp:10–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8};
9
10sol::table open_mylib(sol::this_state s) {
11 sol::state_view lua(s);
12
13 sol::table module = lua.create_table();
14 module["func"] = []() {
15 /* super cool function here */
16 return 2;
17 };
18 // register a class too
19 module.new_usertype<some_class>(
20 "some_class", "bark", &some_class::bark);
21
22 return module;
23}
24
25int main() {
26 std::cout << "=== require ===" << std::endl;

Callers

nothing calls this directly

Calls 1

create_tableMethod · 0.80

Tested by

no test coverage detected