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

Function main

examples/source/overloading_with_fallback.cpp:28–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26}
27
28int main(int, char*[]) {
29 std::cout << "=== overloading with fallback ==="
30 << std::endl;
31
32 sol::state lua;
33 lua.open_libraries();
34
35 lua.set_function(
36 "f", sol::overload(func_1, func_2, fallback));
37
38 lua.script("print(f(1))"); // func_1
39 lua.script("print(f('hi'))"); // func_2
40 lua.script("print(f(22, 11))"); // fallback
41 lua.script("print(f({}))"); // fallback
42
43 return 0;
44}

Callers

nothing calls this directly

Calls 3

overloadFunction · 0.85
open_librariesMethod · 0.80
scriptMethod · 0.80

Tested by

no test coverage detected