Re: [ANN] lcm -- Lua Code Melder, 2026-04
mjmouse9999 <[email protected]> Fri, 24 Apr 2026 05:28:18 -0700 (PDT)
| Newsgroups | gmane.comp.lang.lua.general |
|---|---|
| Message-ID | <[email protected]> |
On Friday, April 24, 2026 at 5:30pm Martin Eden wrote:
> On 2026-04-24 01:16, mjmouse9999 wrote:
> > It also scans the dependencies by looking for require
> > statements
> > (This is helped by the fact that Teal always includes the brackets)
> >
> > [...]
> >
> > https://github.com/teal-language/tl/blob/main/extras/combine.tl
> Scanning for deps in dynamic languages via parsing source generally
> doesn't work:
>
> function request(str)
> return require(str)
> end
>
> request('debug')
Yes. Teal also requires all the calls that actually use the module
to be in the format require("code") or pcall(require, "code").
Once you wrap the function in Teal, it loses its special typechecking
functionality:
local function readmodule(s: string): any
return require(s)
end
local res = readmodule("some.module")
res.this() -- This fails since res is 'any'
But just assigning to a variable keeps the functionality:
local ha = require
local result = ha("ha") -- this call is still recognised as a special one
result:dostuff() -- result does actually get the type from the module
> Before deploy I'm actually running main code. My strain of "require"
> wrapper tracks run-time dependencies in global table. Which is later
> used to go and copy those files.
That makes sense.
For module tracking you could also wrap the three file-searching functions
under package.searchers and track that if you still wanted to use require.
--
You received this message because you are subscribed to the Google Groups "lua-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/lua-l/d229f3de-e90c-4a93-8026-413f884ec19dn%40googlegroups.com.