| 47 | // - none |
| 48 | |
| 49 | static int do_set_package_preload(lua_State* L) |
| 50 | { |
| 51 | // Note: Use ordinary set/get instead of the raw variants, because this |
| 52 | // function should not be performance sensitive anyway. |
| 53 | lua_pushglobaltable(L); |
| 54 | lua_getfield(L, -1, "package"); |
| 55 | lua_remove(L, -2); // Remove global table. |
| 56 | lua_getfield(L, -1, "preload"); |
| 57 | lua_remove(L, -2); // Remove package table. |
| 58 | lua_insert(L, -3); // Move package.preload beneath key and value. |
| 59 | lua_settable(L, -3); // package.preload[modulename] = loader |
| 60 | return 0; |
| 61 | } |
| 62 | |
| 63 | static int proxy_loader(lua_State* L) |
| 64 | { |
nothing calls this directly
no test coverage detected