VAR

BlitzMax Forums/BlitzMax Beginners Area/VAR

Here's another example (with a call to the function using the by-reverence variables):


Graphics 640, 480, 16, -1

Function GetMouseCoords(xToSet var, yToSet var)

	xToSet = MouseX()
	yToSet = MouseY()

End Function

Local myX, myY

	myX = 0
	myY = 0

	Print myX + ", " + myY
		' output will be "0, 0"

	MoveMouse(200, 400)

	GetMouseCoords(myX, myY)

	Print myX + ", " + myY
		' output will be "200, 400" because myX and myY were passed by reference