Skip to content

pass a state parameter to useratom#2256

Merged
vegorov-rbx merged 1 commit intoluau-lang:masterfrom
jackdotink:useratom-state
Feb 26, 2026
Merged

pass a state parameter to useratom#2256
vegorov-rbx merged 1 commit intoluau-lang:masterfrom
jackdotink:useratom-state

Conversation

@jackdotink
Copy link
Copy Markdown
Contributor

Closes #2083.

This PR adds a state parameter to the useratom callback. While this is a breaking change, it requires very minimal updates to embedder code.

The reasons for this change are in #2083, but again, all other callbacks have state, and in useratom's current form, I must use a global mutable static variable to effectively use it. Which is not ideal.

@vegorov-rbx
Copy link
Copy Markdown
Collaborator

Thank you for the improvement.

@vegorov-rbx vegorov-rbx merged commit 813167a into luau-lang:master Feb 26, 2026
7 checks passed
aatxe added a commit that referenced this pull request Mar 6, 2026
Hi there, folks! We're back with another weekly Luau release!

# Language

* Adds the `const` keyword for defining constant bindings that are
statically forbidden to be reassigned to. This implements
[luau-lang/rfcs#166](luau-lang/rfcs#166).
* Adds a collection of new math constants to Luau's `math` library per
[luau-lang/rfcs#169](luau-lang/rfcs#169).

# Analysis

* Fixes a class of bugs where Luau would not retain reasonable upper or
lower bounds on free types, resulting in types snapping to `never` or
`unknown` despite having bounds.
```luau
--!strict
-- `lines` will be inferred to be of `{ string }` now, and prior
-- was 
local lines = {}
table.insert(lines, table.concat({}, ""))
print(table.concat(lines, "\n"))
```
```luau
--!strict
-- `buttons` will be inferred to be of type `{ { a: number } }`
local buttons = {}
table.insert(buttons, { a = 1 })
table.insert(buttons, { a = 2, b = true })
table.insert(buttons, { a = 3 })
```
* Disables the type error from `string.format` when called with a
dynamically-determined format string (i.e. a non-literal string argument
with the type `string`) in response to user feedback about it being too
noisy.
* Resolves an ICE that could occur when type checking curried generic
functions. Fixes #2061!
* Fixes false positive type errors from doing equality or inequality
against `nil` when indexing from a table
* In #2256, adds a state parameter to the `useratom` callback for
consistency with other callbacks.

# Compiler
- Improves the compiler's type inference for vector component access,
numerical for loops, function return types and singleton type
annotations, fixing #2244 #2235 and #2255.

# Native Code Generation

- Fixes a bug where some operations on x86_64 would produce integers
that would take up more than 32-bits when a 32-bit integer is expected.
We resolve these issues by properly truncating to 32-bits in these
situations.
- Improves dead store elimination for conditional jumps and fastcalls
arguments, improving overall native codegen performance by about 2% on
average in benchmarks, with some benchmarks as high as 25%.

---------

Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

give state argument to useratom callback

2 participants