| 474 | } |
| 475 | |
| 476 | static 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 | |
| 494 | static 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. |
no test coverage detected