MCPcopy Create free account
hub / github.com/dail8859/NotepadNext / push_iface_function

Function push_iface_function

src/LuaExtension.cpp:476–492  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

474}
475
476static int push_iface_function(lua_State *L, const char *name, IFaceTableInterface *iface) {
477 auto func = iface->FindFunction(name);
478 if (func != nullptr) {
479 if (IFaceFunctionIsScriptable(*func)) {
480 lua_pushlightuserdata(L, (void*)func);
481 lua_pushcclosure(L, cf_pane_iface_function, 1);
482
483 // Since Lua experts say it is inefficient to create closures / cfunctions
484 // in an inner loop, I tried caching the closures in the metatable, and looking
485 // for them there first. However, it made very little difference and did not
486 // seem worth the added complexity. - WBD
487
488 return 1;
489 }
490 }
491 return -1; // signal to try next pane index handler
492}
493
494static int push_iface_propval(lua_State *L, const char *name, IFaceTableInterface *iface) {
495 // this function doesn't raise errors, but returns 0 if the function is not handled.

Callers 1

cf_pane_metatable_indexFunction · 0.85

Calls 2

FindFunctionMethod · 0.45

Tested by

no test coverage detected