teal-language / tl

The compiler for Teal, a typed dialect of Lua
MIT License
2.12k stars 107 forks source link

`...` is not populated when `tl run` loads a Lua module #689

Closed fperrad closed 1 year ago

fperrad commented 1 year ago
$ cat ld.lua 
require'foo'
print('Done')
$ cat foo.lua 
print(...)
$ lua ld.lua 
foo ./foo.lua
Done
$ ./tl run ld.lua 

Done
hishamhm commented 1 year ago

@fperrad Is this behavior documented? I tried to find it in the Lua manual but I must have missed it. I am in favor of implementing, but ideally I would like to follow the documentation to ensure I got the behavior right.

fperrad commented 1 year ago

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.)