|
Diego Nehab wrote:
Yes. It looks for a resource called luamodule_a.b.c in the file(s) returned from cpath.Hi,In my implementation, package.alias is only used if the cRoot and RC loaders cannot find a package; in that case it effectively re-tries cRoot and RC with package.alias.name as the filename, again using cpath.What does the RC loader do? The same as the C loader, but trying to get the chunk from a resource name that is a function of the subpackage name?
I have played games with the preload table, but to work in all cases (eg require a.b.c), the preload table needs to be filled in for all sub-modules. I am trying out the alias approach (which can still be an add-on loader) so that package.alias.mime=socket will resolve correctly for require"mime.xyz", without needing a whole slew of entries.How about playing tricks with the metatable of package.preload? You should be able use pattern matching to resolve names.
Yes, I thought of that, but the alias approach is a lot simpler. Adrian