Posted: 15th Aug 2011 21:02
Do functions accept UDTs?

Can functions return UDTs?
Posted: 16th Aug 2011 6:10
Yes and Yes Try it out!
Posted: 16th Aug 2011 12:24
Thanks Lee.

Maybe you can help me with the following chunk of code then. It compiles without error, but the exe stops working (windows message) when I compile, run and broadcast.

type playerType
name$
score
endtype

player1 as playerType

player1.name$ = "Bob"
player1.score = 100

do
showPlayer(player1)
sync()
loop

function showPlayer(player as playerType)
print(player.name$)
print(player.score)
endfunction
Posted: 16th Aug 2011 13:40
I've had the same problem DrT, I've reported it in here:
http://forum.thegamecreators.com/?m=forum_view&t=188136&b=41

But you should do also

However, returning a UDT from a function works fine!
Posted: 16th Aug 2011 15:04
And even more simpler, this crashes too:

type playerType
score
endtype
player1 as playerType
player1.score = 100
do
showPlayer(player1)
sync()
loop
function showPlayer(player as playerType)
print(player.score)
endfunction

Will deal for the next build, thanks.
Posted: 16th Aug 2011 22:28
Thank you BiggAdd and Lee.
Posted: 1st Sep 2011 2:36
I define a UDT with a string field. I then set this field in a function and return the UDT. The returned UDT now has an empty string field. Is this a bug or am I overlooking something?

+ Code Snippet
type mytype
    name$
    age
    temp#
endtype

me as mytype

me = assignMe()

do
    print(me.name$)
    print(me.age)
    print(me.temp#)
    sync()
loop

function assignMe ()
    you as myType
    you.name$ = "Bob"
    you.age = 20
    you.temp# = 98.6
endfunction you
Posted: 5th Sep 2011 4:36
I can confirm this as a bug in 1.0.3.6. I will see what I can do about a good bug reporting system to capture these. Watch this space!
Posted: 5th Sep 2011 4:41
For future reference, the new home for all AppGameKit bugs is here: http://code.google.com/p/agk/issues/list