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

fix: populate ... for required modules #693

Merged
merged 4 commits into from
Sep 5, 2023
Merged

fix: populate ... for required modules #693

merged 4 commits into from
Sep 5, 2023

Conversation

hishamhm
Copy link
Member

@hishamhm hishamhm commented Sep 4, 2023

Fixes #689.

@github-actions
Copy link

github-actions bot commented Sep 5, 2023

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

Instead of hardcoding the arguments within the loader, pass them
through the searcher, as specified by the documented behavior:

#689 (comment)

> quoted from https://www.lua.org/manual/5.4/manual.html#pdf-require
>
>> 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.)

Thanks @fperrad for the research!
This implements a compromise solution that allows Teal modules
to always get both arguments, even in Lua 5.1 based systems
(this should be harmless for modules which don't expect a second
argument there), without hardcoding `loader_data`, just in case
the user is on an environment that runs a patched `require` for
debug reasons or something.
@hishamhm hishamhm merged commit e29e29b into master Sep 5, 2023
8 checks passed
@hishamhm hishamhm deleted the fix-689 branch September 5, 2023 15:16
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.

... is not populated when tl run loads a Lua module
1 participant