can I pass user defined types as arguments?

BlitzPlus Forums/BlitzPlus Beginners Area/can I pass user defined types as arguments?

bryan970(Posted 2006) [#1]
my first question is can you include image handles in
your type

type bullet
field x,y
field whatever
field bulletimage ?????
end type

my second is can you pass a type as an argument to a function
For bullet.bullet = each bullet
if blah blah blah
DoSomething(bullet)
elseif
blah blah blah
else
blah blah blah
end if
Next
end function


GfK(Posted 2006) [#2]
Yes. To both.


bryan970(Posted 2006) [#3]
cool how do I do it I keep getting errors when I try

is it
field bulletimage$ ? because I don't think that was working for me

and on the function would it be
Function DoSomething(Bullet) because I don't think that was working for me either


Adam Novagen(Posted 2006) [#4]
I think you can pass type fields, like this:
DoSomething(bullet\image)
but I don't think you can pass an entire type into a function.


b32(Posted 2006) [#5]
You can define the function like this:
Function DoSomething(b.bullet)

If you want to return a type, use this:
Function DoSomething.Bullet()


Adam Novagen(Posted 2006) [#6]
Woah. Every time I think I know about Types, I get surprised with some new info. Go, Blitz!!!