mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Clarify how module paths are evaluated
This commit is contained in:
parent
dd93d75706
commit
c976ab2eb6
1 changed files with 1 additions and 1 deletions
|
@ -46,7 +46,7 @@ local foo = doSomething(require("foo")) -- ok
|
||||||
local bar = doSomething(import from "foo") -- not ok
|
local bar = doSomething(import from "foo") -- not ok
|
||||||
```
|
```
|
||||||
|
|
||||||
Since this statement will need to be evaluated for the purposes of type autocomplete/inference/etc, the argument *must* be statically evaluatable (as is currently done to provide typechecking for `require()`):
|
The module path is evaluated at runtime, but is required to be analysable for the purposes of static type checking. Specifically, imports are *not* hardcoded at compile time, because especially in Roblox-like environments, the same code may execute from different locations.
|
||||||
|
|
||||||
```Lua
|
```Lua
|
||||||
import from "foo" -- ok
|
import from "foo" -- ok
|
||||||
|
|
Loading…
Add table
Reference in a new issue