parent
9939c5c361
commit
2cd63aa589
|
@ -29,7 +29,7 @@ However, in strict mode, the second snippet would be able to infer `number` for
|
||||||
|
|
||||||
## Unknown symbols
|
## Unknown symbols
|
||||||
|
|
||||||
You may see this error a lot, and that's by design even in nonstrict mode.
|
You may see this error when using custom globals, and that's by design even in nonstrict mode.
|
||||||
|
|
||||||
Consider how often you're likely to assign a new value to a local variable. What if you accidentally misspelled it? Oops, it's now assigned globally and your local variable is still using the old value.
|
Consider how often you're likely to assign a new value to a local variable. What if you accidentally misspelled it? Oops, it's now assigned globally and your local variable is still using the old value.
|
||||||
|
|
||||||
|
@ -41,6 +41,8 @@ soeLocal = 2 -- the bug
|
||||||
print(someLocal)
|
print(someLocal)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Because of this, Luau type checker currently emits an error whenever a non-function global is used; use local variables instead.
|
||||||
|
|
||||||
## Structural type system
|
## Structural type system
|
||||||
|
|
||||||
Luau's type system is structural by default, which is to say that we inspect the shape of two tables to see if they are similar enough. This was the obvious choice because Lua 5.1 is inherently structural.
|
Luau's type system is structural by default, which is to say that we inspect the shape of two tables to see if they are similar enough. This was the obvious choice because Lua 5.1 is inherently structural.
|
||||||
|
|
Loading…
Reference in New Issue