Difference between revisions of "ObjectType:int"
Jump to navigation
Jump to search
(9 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{ObjectType-Vitals|int|[[LavishScript]]|none|The string representation of this number|[[ObjectType:int|int]]|no|int}} | ||
== Description == | == Description == | ||
− | Short for <tt>integer</tt>, an int is a whole number that can be represented in 32 bits. This datatype is limited to the numbers -2,147,483,648 to 2,147,483,647. | + | Short for <tt>integer</tt>, an int is a whole number that can be represented in 32 bits. This datatype is limited to the numbers -2,147,483,648 to 2,147,483,647 (2 billion). |
+ | |||
== Members == | == Members == | ||
Line 6: | Line 8: | ||
* [[DataType:string|string]] '''Hex''': A hexadecimal string equivalent to this number | * [[DataType:string|string]] '''Hex''': A hexadecimal string equivalent to this number | ||
* [[DataType:int|int]] '''Reverse''': This number, with its bytes reversed (1234 is turned into 3523477504.. easier to see in hex: 00 00 04 D2 -> D2 04 00 00) | * [[DataType:int|int]] '''Reverse''': This number, with its bytes reversed (1234 is turned into 3523477504.. easier to see in hex: 00 00 04 D2 -> D2 04 00 00) | ||
+ | * [[DataType:string|string]] '''LeadingZeroes['''#''']''': A string representation of this number, with at least this many decimal places. The number will be lead with zeroes to reach the desired length | ||
+ | * [[DataType:uint|uint]] '''Unsigned''': This number as 32-bit unsigned | ||
+ | * [[ObjectType:bool|bool]] '''Between[a,b]''': TRUE if a<= value and value <= b | ||
+ | * [[ObjectType:bool|bool]] '''Equal['''[[LavishScript:Mathematical Formulae|formula]]''']''': TRUE if the int matches the specified value | ||
+ | * [[ObjectType:string|string]] '''AsJSON''': A string with the value of the int, as would be in JSON | ||
+ | |||
== Methods == | == Methods == | ||
* '''Inc''': Increments this int by 1 | * '''Inc''': Increments this int by 1 | ||
− | * '''Inc['''formula''']''': Increments this int by a given amount | + | * '''Inc['''[[LavishScript:Mathematical Formulae|formula]]''']''': Increments this int by a given amount |
* '''Dec''': Decrements this int by 1 | * '''Dec''': Decrements this int by 1 | ||
− | * '''Dec['''formula''']''': Decrements this int by a given amount | + | * '''Dec['''[[LavishScript:Mathematical Formulae|formula]]''']''': Decrements this int by a given amount |
− | * '''Set['''formula''']''': Sets this int to a given value | + | * '''Set['''[[LavishScript:Mathematical Formulae|formula]]''']''': Sets this int to a given value |
− | |||
− | |||
== Examples == | == Examples == | ||
+ | ===Declare an integer=== | ||
+ | *declare Count int 37 | ||
+ | ===Set an integer's value=== | ||
+ | *Count:Set[37430] | ||
+ | ===Add two integers=== | ||
+ | *Total:Set[${Total}+${Current}] | ||
+ | ===Increment an integer=== | ||
+ | *Count:Inc | ||
+ | ===Decrement an integer=== | ||
+ | *Count:Dec | ||
+ | |||
== See Also == | == See Also == | ||
− | + | {{LavishScript:ObjectType}} | |
− | |||
− |
Latest revision as of 14:24, 14 October 2019
int | |
Defined By | LavishScript |
Inherits | none |
Reduces To | The string representation of this number |
Variable Object Type | int |
Uses Sub-Types | no |
C/C++ Type | int |
Contents
Description
Short for integer, an int is a whole number that can be represented in 32 bits. This datatype is limited to the numbers -2,147,483,648 to 2,147,483,647 (2 billion).
Members
- float Float: This number, converted to a float
- string Hex: A hexadecimal string equivalent to this number
- int Reverse: This number, with its bytes reversed (1234 is turned into 3523477504.. easier to see in hex: 00 00 04 D2 -> D2 04 00 00)
- string LeadingZeroes[#]: A string representation of this number, with at least this many decimal places. The number will be lead with zeroes to reach the desired length
- uint Unsigned: This number as 32-bit unsigned
- bool Between[a,b]: TRUE if a<= value and value <= b
- bool Equal[formula]: TRUE if the int matches the specified value
- string AsJSON: A string with the value of the int, as would be in JSON
Methods
- Inc: Increments this int by 1
- Inc[formula]: Increments this int by a given amount
- Dec: Decrements this int by 1
- Dec[formula]: Decrements this int by a given amount
- Set[formula]: Sets this int to a given value
Examples
Declare an integer
- declare Count int 37
Set an integer's value
- Count:Set[37430]
Add two integers
- Total:Set[${Total}+${Current}]
Increment an integer
- Count:Inc
Decrement an integer
- Count:Dec
See Also
LavishScript Object Types
- Text
- string - mutablestring - unistring
- Numbers
- byte - float - float64 - int - uint - int64
- Boolean (TRUE/FALSE)
- bool
- Pointers
- boolptr - byteptr - floatptr - float64ptr - intptr - uintptr - int64ptr - rgbptr - stringptr
- Containers
- objectcontainer - array - index - collection - queue - stack - set - variablescope
- JSON
- jsonobject - jsonarray - jsonvaluecontainer - jsonvalue
- Iteration
- iterator - jsoniterator
- Date/Time
- time
- File Handling
- filepath - file - filelist - filelistentry
- Tasks
- lavishmachine - Accessed via the Top-Level Object LMAC
- task - tasklibrary - taskmanager - tasktype - taskpulseargs - elmactaskstate