Closed dankmolot closed 12 months ago
The restriction from import
statement is for adding possible static checking functions with standardized module path in the future. And you can currently use the require
function call for the general dynamic module loading purpose.
import a, b, c from require "https://example.com/module.lua"
Alright, many thanks for such a fast response and workaround for this problem!
Currently
import
statement checks string by pattern that requiresA-Za-z0-9\-_
at the start, and only then allows.
after first character is allowed symbol. But this pattern check removes flexibility of using customrequire
.In Garry's Mod I'm making npm-like package manager that also allows to use require like ESM import statement. For example
./module.lua
,package-b
andhttps://example.com/module.lua
. But current implementation of parser disallows use of first and last example, since first starts with.
, and second has:
.Is it necessary to have this limitation?