MCPcopy Create free account
hub / github.com/MihailRis/voxelcore / create_lambda_handler

Function create_lambda_handler

src/logic/scripting/lua/lua_util.cpp:185–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183}
184
185static std::shared_ptr<std::string> create_lambda_handler(State* L) {
186 auto ptr = reinterpret_cast<ptrdiff_t>(topointer(L, -1));
187 auto name = util::mangleid(ptr);
188 getglobal(L, LAMBDAS_TABLE);
189 pushvalue(L, -2);
190 setfield(L, name);
191 pop(L, 2);
192
193 return std::shared_ptr<std::string>(new std::string(name), [=](std::string* name) {
194 getglobal(L, LAMBDAS_TABLE);
195 pushnil(L);
196 setfield(L, *name);
197 pop(L);
198 delete name;
199 });
200}
201
202runnable lua::create_runnable(State* L) {
203 auto funcptr = create_lambda_handler(L);

Callers 2

create_runnableMethod · 0.85
create_lambdaMethod · 0.85

Calls 6

topointerFunction · 0.85
getglobalFunction · 0.85
pushvalueFunction · 0.85
setfieldFunction · 0.85
popFunction · 0.85
pushnilFunction · 0.85

Tested by

no test coverage detected