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