MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / loadfunc

Function loadfunc

third-party/lua-5.5.0/src/loadlib.c:556–571  ·  view source on GitHub ↗

** Try to find a load function for module 'modname' at file 'filename'. ** First, change '.' to '_' in 'modname'; then, if 'modname' has ** the form X-Y (that is, it has an "ignore mark"), build a function ** name "luaopen_X" and look for it. (For compatibility, if that ** fails, it also tries "luaopen_Y".) If there is no ignore mark, ** look for a function named "luaopen_modname". */

Source from the content-addressed store, hash-verified

554** look for a function named "luaopen_modname".
555*/
556static int loadfunc (lua_State *L, const char *filename, const char *modname) {
557 const char *openfunc;
558 const char *mark;
559 modname = luaL_gsub(L, modname, ".", LUA_OFSEP);
560 mark = strchr(modname, *LUA_IGMARK);
561 if (mark) {
562 int stat;
563 openfunc = lua_pushlstring(L, modname, ct_diff2sz(mark - modname));
564 openfunc = lua_pushfstring(L, LUA_POF"%s", openfunc);
565 stat = lookforfunc(L, filename, openfunc);
566 if (stat != ERRFUNC) return stat;
567 modname = mark + 1; /* else go ahead and try old-style name */
568 }
569 openfunc = lua_pushfstring(L, LUA_POF"%s", modname);
570 return lookforfunc(L, filename, openfunc);
571}
572
573
574static int searcher_C (lua_State *L) {

Callers 2

searcher_CFunction · 0.70
searcher_CrootFunction · 0.70

Calls 4

luaL_gsubFunction · 0.70
lua_pushlstringFunction · 0.70
lua_pushfstringFunction · 0.70
lookforfuncFunction · 0.70

Tested by

no test coverage detected