-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: populate
...
for required modules (#693)
* fix: populate `...` for required modules Fixes #689. * adjust code to more closely match documented semantics 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! * loader args: provide consistent behavior across Lua versions 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.
- Loading branch information
Showing
3 changed files
with
36 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters