IntValue
A container object for a single integer.
Memory category | Instances |
---|
Member index 3
Description
An IntValue stores a single signed 64-bit integer. The highest allowed value is 2^63-1 or around 9.2 quintillion (9.2^18); attempting to store larger numbers will cause integer overflow. The lowest allowed value is -2^63 or about -9.2 quintillion. Practically, however, working with integers larger than 2^53 (9.0^15) will cause loss of precision since Luau uses double-precision floating-point to store numbers.
Note that it's possible to store values between 2^53 and 2^63-1 via the Properties window since it uses strings to pass data to the engine, but manipulating large values via Luau scripts will result in loss of precision and rounding as mentioned above.
The main advantage of using IntValue lies in its rounding of values to the nearest integer, with halfway cases rounded away from 0. For values outside of this range, use a NumberValue instead. Like all ValueBase objects, this single value is stored in the Value property.
The Changed event for this (and other objects like it) will run with the new value being stored in the object, instead of a string representing the property being changed.
History 14
- 553 Change PreferredDescriptor of changed from to Changed
- 553 Change Default of Value from to 0
- 486 Change ThreadSafety of Value from ReadOnly to ReadSafe
- 462 Change ThreadSafety of changed from to Unsafe
- 462 Change ThreadSafety of Changed from to Unsafe
- 462 Change ThreadSafety of Value from to ReadOnly
- 345 Change Parameters of changed from (value: int) to (value: int64)
- 345 Change Parameters of Changed from (value: int) to (value: int64)
- 345 Change ValueType of Value from int to int64
- 335 Change Superclass of IntValue from Instance to ValueBase
- 50 Add changed
- 47 Add Changed
- 47 Add Value
- 47 Add IntValue
Members 3
Changed
Parameters (1) | |
---|---|
value | int64 |
This event fires whenever the IntValue.Value is changed. It will run with the new value being stored in the argument object, instead of a string representing the property being changed.
Equivalent change events exist for similar objects such as NumberValue and StringValue, depending on what object type best suits the need.
Thread safety | Unsafe |
---|
Value
Type | Default | |
---|---|---|
int64 | 0 |
Used to hold an integer.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true |
changed
Parameters (1) | |
---|---|
value | int64 |
Thread safety | Unsafe |
---|