what Beaker says.
There are built-in classes for this. This is a small sample that show two different methods to pass an integer by reference (ala BlitzMax var):
Function Main()
'Method one:
Local number:Int = 5
'We want to pass number by reference:
Local container:= New IntObject(number)
ByRefFunction(container)
'We retrive the result:
number = container.value
'We get the result
Print number
'Method 2:
'We prepare an array to send the data:
Local data:= New Int[1]
data[0] = number
ByRefFunctionTwo(data)
'We retrieve the data back to the variable
number = data[0]
Print number
End
Function ByRefFunction(data:IntObject)
data.value = data.value * 2
End
Function ByRefFunctionTwo(data:Int[])
data[0] = data[0] * 2
End
|