AGK supports passing a UDT into a function, and also returning a UDT from a function.
But at the moment passing a UDT into a function causes a crash. The bug as been reported and it will be fixed in the next update.
Passing UDT to Function (Will be fixed next update):
+ Code SnippetTYPE testType
xPos as Integer
yPos as Integer
ENDTYPE
myvar as testType
myvar.xPos = 0
myvar.yPos = 0
adtTest(myvar)
do
Print(myvar.xPos)
Print(myvar.yPos)
Sync()
loop
FUNCTION adtTest(test as testType)
test.xPos = 100
test.yPos = 150
ENDFUNCTION
Returning UDT from function(Works!):
+ Code SnippetTYPE testType
xPos as Integer
yPos as Integer
ENDTYPE
myvar as testType
myvar = new_Test()
do
Print(myvar.xPos)
Print(myvar.yPos)
Sync()
loop
FUNCTION new_Test()
temp as testType
temp.xPos = 100
temp.yPos = 250
ENDFUNCTION temp