can I pass user defined types as arguments?
BlitzPlus Forums/BlitzPlus Beginners Area/can I pass user defined types as arguments?
| ||
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 |
| ||
Yes. To both. |
| ||
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 |
| ||
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. |
| ||
You can define the function like this: Function DoSomething(b.bullet) If you want to return a type, use this: Function DoSomething.Bullet() |
| ||
Woah. Every time I think I know about Types, I get surprised with some new info. Go, Blitz!!! |