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

Method func

examples/source/self_from_lua.cpp:25–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23 }
24
25 void func(sol::this_state ts) const {
26 lua_State* L = ts;
27 // references the object that called this function
28 // in regular member functions:
29 sol::stack_object selfobj(L, 1);
30 // "1" is the bottom of the Lua stack
31 // 2 is one up, so on and so forth...
32 thing& self = selfobj.as<thing>();
33
34 // definitely the same
35 SOL_ASSERT(&self == this);
36 }
37 };
38
39 sol::state lua;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected