Passing an array to a PUB?
Hugh
Posts: 362
Can I pass arrays to a PUB?
e.g., if I have two arrays, arrayFirst[16] and arraySecond[16] can I call a PUB by, for example, dostuff[arrayFirst] and use either of these arrays, handling either by the same code?
I'd prefer to it this way, but one big array and multiple offsets might be another.
I've been going round in circles with various attempts at this.
Cheers
Hugh
e.g., if I have two arrays, arrayFirst[16] and arraySecond[16] can I call a PUB by, for example, dostuff[arrayFirst] and use either of these arrays, handling either by the same code?
I'd prefer to it this way, but one big array and multiple offsets might be another.
I've been going round in circles with various attempts at this.
Cheers
Hugh
Comments
For your example, you'd use dostuff(@arrayFirst).
Then, you'd have something like:
Pub dostuff|pArray,y
and one way to access the array (if it is a long array) is
x:=long[pArray][y] where y is the index
PS: Also see below for "Similar threads"
If you want to make it more flexible, you could pass the array type (bytes per element) like this: