Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let Lua sort the package.loaded table #922

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mbartlett21
Copy link

This now makes tl work with Lua modules that only populate the package.loaded table. The loader doesn't have to do anything with that table:

Once a loader is found, require calls the loader with two arguments: modname and an extra value, a loader data, also returned by the searcher. The loader data can be any value useful to the module; for the default searchers, it indicates where the loader was found. (For instance, if the loader came from a file, this extra value is the file path.) If the loader returns any non-nil value, require assigns the returned value to package.loaded[modname]. If the loader does not return a non-nil value and has not assigned any value to package.loaded[modname], then require assigns true to this entry. In any case, require returns the final value of package.loaded[modname]. Besides that value, require also returns as a second result the loader data returned by the searcher, which indicates how require found the module.

@mbartlett21 mbartlett21 changed the title Add failing test for tl with a simple Lua module Let Lua sort the package.loaded table Jan 29, 2025
Copy link

Teal Playground URL: https://922--teal-playground-preview.netlify.app

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant