Defining C/C++ Datatypes Help

Hello, I’m just wondering if there is a feature that would allow me to create a number that is stored in memory as a uint32 or similar datatype, rather than being forced to work with a double-float. Thanks.

2 Likes

Afraid not. With Luau being a dynamically typed language, every number is stored as a double, as you mentioned. There’s no way to get around this, at least not that I know of.

You can work around this with buffers, but only as number containers - not for arithmetic.

Note this was changed in Lua 5.3, but Luau is derived from Lua 5.1 so still follows this principle.

2 Likes

You can use buffers to have more control over binary data. This lets you read and write numbers with less information, such as the unsigned 32-bit integers you mentioned.

Only bit32 | Documentation - Roblox Creator Hub or buffer | Documentation - Roblox Creator Hub

bit32 sucks btw
Use buffers instead