Back to Luau

Additional Considerations

types-considerations.md

latest1.5 KB
Original Source

Additional Considerations

Module interactions

Section titled “Module interactions”

Let’s say that we have two modules, Foo and Bar. Luau will try to resolve the paths if it can find any require in any scripts. In this case, when you say ./bar, Luau will resolve it as: relative to this script, go to my sibling script named Bar.

Embedded content

There are some caveats here though. For instance, the require path must be resolvable statically, otherwise Luau cannot accurately type check it.

Cyclic module dependencies

Section titled “Cyclic module dependencies”

Cyclic module dependencies can cause problems for the type checker. In order to break a module dependency cycle a typecast of the module to any may be used:

Embedded content