MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / tolua_ref_function

Function tolua_ref_function

Source/Lua/ToLua/tolua_fix.cpp:102–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102int tolua_ref_function(lua_State* L, int lo) {
103 /* function or thread at lo */
104 int type = lua_type(L, lo);
105 if (type == LUA_TFUNCTION || type == LUA_TTHREAD) {
106 int refid = tolua_alloc_callback_ref_id();
107 lua_pushvalue(L, lo); // fun
108 lua_rawgeti(L, LUA_REGISTRYINDEX, TOLUA_REG_INDEX_CALLBACK); // fun, funcMap
109 lua_insert(L, -2); // funcMap, fun
110 lua_rawseti(L, -2, refid); // funcMap[refid] = fun, funcMap
111 lua_pop(L, 1); // empty
112 return refid;
113 }
114 return 0;
115}
116
117void tolua_get_function_by_refid(lua_State* L, int refid) {
118 lua_rawgeti(L, LUA_REGISTRYINDEX, TOLUA_REG_INDEX_CALLBACK); // funcMap

Callers 15

dora_teal_to_lua_asyncFunction · 0.85
dora_teal_check_asyncFunction · 0.85
dora_teal_complete_asyncFunction · 0.85
dora_teal_infer_asyncFunction · 0.85
dora_yue_check_asyncFunction · 0.85
dora_yue_compileFunction · 0.85
executeReturnMethod · 0.85
Content_loadExcelAsyncFunction · 0.85
Content_searchFilesAsyncFunction · 0.85
Node_slotFunction · 0.85
Node_gslotFunction · 0.85

Calls 6

lua_insertFunction · 0.85
lua_typeFunction · 0.50
lua_pushvalueFunction · 0.50
lua_rawgetiFunction · 0.50
lua_rawsetiFunction · 0.50

Tested by

no test coverage detected