Integers... relatively easy until we add integer support.
Create an array twice as big as your integer needs.
Integer array = 8 elements, dimension a byte array of 16.
dim myIntarray(16)
Create a sub that uses the array, addressing two bytes per integer element, where MyIntarray(1) = upperByte of Integer,MyIntarray(2) = lowerByte of Integer. Then, develop the sub to read and write elements.
Sub MyIntHanderSet( in intelement as byte, in intVar as integer ) [byte]myIntarray(intelement) = intVar_h
myIntarray(intelement+1) = intVar
end sub
Function MyIntHanderRead( in intelement as byte ) as integer [byte]MyIntHanderRead_h = myIntarray(intelement)
MyIntHanderRead = myIntarray(intelement+1)
end sub
Not tested - please adapt, correct and publish back here for others, please.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It appears that only bytes can be stored in arrays and not integers. Is that correct? The (otherwise excellent) help files don't make that clear.
If this is the case, do you have any suggestions on how I could store integers in an array-like structure? Thanks,
-Jim
Second person to ask in a week.
I just revised the Help! Sorry.
Integers... relatively easy until we add integer support.
Create an array twice as big as your integer needs.
Integer array = 8 elements, dimension a byte array of 16.
dim myIntarray(16)
Create a sub that uses the array, addressing two bytes per integer element, where MyIntarray(1) = upperByte of Integer,MyIntarray(2) = lowerByte of Integer. Then, develop the sub to read and write elements.
Something like:
MyIntHanderSet( 2, -100 )
Print MyIntHanderRead(2)
Sub MyIntHanderSet( in intelement as byte, in intVar as integer )
[byte]myIntarray(intelement) = intVar_h
myIntarray(intelement+1) = intVar
end sub
Function MyIntHanderRead( in intelement as byte ) as integer
[byte]MyIntHanderRead_h = myIntarray(intelement)
MyIntHanderRead = myIntarray(intelement+1)
end sub
Not tested - please adapt, correct and publish back here for others, please.
Thanks for the quick reply and your excellent answer.
Sorry I had to make you answer a second time. I did a quick search in the forum earlier but didn't see it mentioned.