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

Function main

examples/source/config.cpp:21–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19};
20
21int main() {
22 sol::state lua;
23 config screen;
24 // To use the file, uncomment here and make sure it is in
25 // local dir lua.script_file("config.lua");
26 lua.script(R"(
27name = "Asus"
28width = 1920
29height = 1080
30)");
31 screen.name = lua.get<std::string>("name");
32 screen.width = lua.get<int>("width");
33 screen.height = lua.get<int>("height");
34 SOL_ASSERT(screen.name == "Asus");
35 SOL_ASSERT(screen.width == 1920);
36 SOL_ASSERT(screen.height == 1080);
37
38 std::cout << "=== config ===" << std::endl;
39 screen.print();
40 std::cout << std::endl;
41}

Callers

nothing calls this directly

Calls 2

scriptMethod · 0.80
printMethod · 0.45

Tested by

no test coverage detected