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

Function main

examples/source/docs/simple_structs.cpp:13–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11};
12
13int main() {
14 sol::state lua;
15 lua.new_usertype<vars>(
16 "vars", "boop", &vars::boop, "bop", &vars::bop);
17 lua.script(
18 "beep = vars.new()\n"
19 "beep.boop = 1\n"
20 "bopvalue = beep:bop()");
21
22 vars& beep = lua["beep"];
23 int bopvalue = lua["bopvalue"];
24
25 SOL_ASSERT(beep.boop == 1);
26 SOL_ASSERT(lua.get<vars>("beep").boop == 1);
27 SOL_ASSERT(beep.bop() == 2);
28 SOL_ASSERT(bopvalue == 2);
29
30 return 0;
31}

Callers

nothing calls this directly

Calls 2

scriptMethod · 0.80
bopMethod · 0.80

Tested by

no test coverage detected