You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
searcher that walks the stack back and derives the relative modname by inspecting the stack
localsearcher0=package.searchers[2]
table.insert(package.searchers, 1, function(modname)
ifmodname:sub(1,1) ~="." thenreturnnilendlocal_, parent=debug.getlocal(3, -1)
local_, path=debug.getlocal(3, -2)
ifparent==nilorpath==nilthenreturnnilend-- Check if we imported a module or a fileifpath:match("init.lua$") ==nilthenparent=parent:match("(.-)%.[^%.]+$")
endmodname=parent..modnamereturnsearcher0(modname)
end )
(incomplete implementation, but shows you roughly how it would work. Far more efficient when written in C)
The text was updated successfully, but these errors were encountered:
Came up in Discord, I'm personally not too happy with the current resolve implementation that overwrites the function and has to store the state.
For this 3 choices were layed out:
Keep the current system that just works™️, simple (as in you don't need to pass other variables), can workaround the init/not init by using . vs ..
Add parameters to require that take the current modpath and actual path:
with me later proposing a 4th:
(incomplete implementation, but shows you roughly how it would work. Far more efficient when written in C)
The text was updated successfully, but these errors were encountered: