Skip to content

Commit 2fd6c55

Browse files
sync: update documentation sources (2026-03-11 18:55 UTC)
1 parent 85ca21c commit 2fd6c55

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

β€Žluau/getting-started/compatibility.mdβ€Ž

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ If integers are taken out of the equation, bitwise operators make less sense, as
104104

105105
| feature | status | notes |
106106
|--|--|--|
107-
| new generational mode for garbage collection | πŸ”œ | we're working on gc optimizations and generational mode is on our radar
107+
| new generational mode for garbage collection | πŸ€·β€β™€οΈ | we've implemented other optimizations to garbage collection
108108
| to-be-closed variables | ❌ | the syntax is inconsistent with how we'd like to do attributes long-term; no strong use cases in our domain |
109-
| const variables | ❌ | while there's some demand for const variables, we'd never adopt this syntax |
110-
| new implementation for math.random | βœ”οΈ | our RNG is based on PCG, unlike Lua 5.4 which uses Xoroshiro |
109+
| const variables | ❌ | available through `const var = value` syntax |
110+
| new implementation for `math.random` | βœ”οΈ | our RNG is based on PCG, unlike Lua 5.4 which uses Xoroshiro |
111111
| optional `init` argument to `string.gmatch` | πŸ€·β€β™€οΈ | no strong use cases |
112112
| new functions `lua_resetthread` and `coroutine.close` | βœ”οΈ ||
113113
| coercions string-to-number moved to the string library | 😞 | we love this, but it breaks compatibility |
@@ -120,7 +120,20 @@ If integers are taken out of the equation, bitwise operators make less sense, as
120120

121121
Taking syntax aside (which doesn't feel idiomatic or beautiful), `<close>` isn't very useful in Luau - its dominant use case is for code that works with external resources like files or sockets, but we don't provide such APIs - and has a very large complexity cost, evidences by a lot of bug fixes since the initial implementation in 5.4 work versions. `<const>` in Luau doesn't matter for performance - our multi-pass compiler is already able to analyze the usage of the variable to know if it's modified or not and extract all performance gains from it - so the only use here is for code readability, where the `<const>` syntax is... suboptimal.
122122

123-
If we do end up introducing const variables, it would be through a `const var = value` syntax, which is backwards compatible through a context-sensitive keyword similar to `type`. That said, there's ambiguity wrt whether `const` should simply behave like a read-only variable, ala JavaScript, or if it should represent a stronger contract, for example by limiting the expressions on the right hand side to ones compiler can evaluate ahead of time, or by freezing table values and thus guaranteeing immutability.
123+
Const variables are available in Luau through a `const var = value` syntax, which is backwards compatible through a context-sensitive keyword (similar to `type`).
124+
125+
## Lua 5.5
126+
127+
| feature | status | notes |
128+
|--|--|--|
129+
| declarations for global variables | ❌ | no strong use cases, mistakes are caught by typechecker |
130+
| named vararg tables | πŸ€·β€β™€οΈ | |
131+
| for-loop variables are read only | ❌ | breaks compatibility |
132+
| floats are printed in decimal with enough digits to be read back correctly | βœ”οΈ | |
133+
| `table.create(arraysize, recordsize)` | ❌ | breaks compatibility |
134+
| `utf8.offset` returns also final position of character | πŸ€·β€β™€οΈ | |
135+
| external strings | ❌ | not compatible with internal object structure; |
136+
| new functions `luaL_openselectedlibs` and `luaL_makeseed` | πŸ€·β€β™€οΈ | |
124137

125138
## Differences from Lua
126139

0 commit comments

Comments
Β (0)