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

Method create_lambda

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

Source from the content-addressed store, hash-verified

210}
211
212scripting::common_func lua::create_lambda(State* L) {
213 auto funcptr = create_lambda_handler(L);
214 return [=](const std::vector<dynamic::Value>& args) {
215 getglobal(L, LAMBDAS_TABLE);
216 getfield(L, *funcptr);
217 for (const auto& arg : args) {
218 pushvalue(L, arg);
219 }
220 if (call(L, args.size(), 1)) {
221 auto result = tovalue(L, -1);
222 pop(L);
223 return result;
224 }
225 return dynamic::Value(dynamic::NONE);
226 };
227}
228
229int lua::create_environment(State* L, int parent) {
230 int id = nextEnvironment++;

Callers

nothing calls this directly

Calls 6

create_lambda_handlerFunction · 0.85
getglobalFunction · 0.85
getfieldFunction · 0.85
pushvalueFunction · 0.85
popFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected