Quote:
Originally Posted by edon1337
Sorry I understand things a little slowly. So if I want to use integers, I can make the cellsize 1, but what if I want to use huge values like 1000000, do I have to use cellsize 7?
|
No. If you set the size to 7, you can store arrays within 7 cell entries.
Code:
// Max cell entries = 7
new Array:array = ArrayCreate( 7 )
new max_array[] = { 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647, 2147483647 }
ArrayPushArray( array, max_array )
The max value you can story in a array, or pawn variable (also known as Pawn cell) is the value of the max signed integer of 4 bytes (
cellsize of 4 bytes), which is here 2.147.483.647
Code:
// Max cell entries = 1
new Array:array = ArrayCreate( 1 )
new max_interger = 2147483647
ArrayPushCell( array, max_interger )
The word cellsize is misleading, the cellsize should means how many bytes a single Pawn cell (an ordinary variable) can hold on. Here each Pawn cell has the `cellsize` of 4 bytes, which means it can hold signed integers until `2.147.483.647`.
If you still do not understand read:
- https://en.wikipedia.org/wiki/Integer_(computer_science)
- https://github.com/compuphase/pawn/raw/master/doc/Pawn_Language_Guide.pdf
__________________