types question
BlitzPlus Forums/BlitzPlus Programming/types question
| ||
How do you return a type from a function? I tryied this but it doesnt work. I get an "Illegal Type Conversion" error when compiling.Type alien Field x,y End type a.alien=randalien() Print a\x Print a\y Waitkey() End Function randalien() a.alien=New alien a\x=Rand(0,100) a\y=Rand(0,100) Return a.alien End Function I get the error where the function returns the varible. Is there anyway to return the a.alien that I create in the function to be used in the main program? |
| ||
Use "Function randalien.alien()" |
| ||
Thanks Falken! |
| ||
No worries |
| ||
Function Foo() returns an integer variable Function Foo#() returns a float variable Function Foo$() returns a string variable Function Foo.Atype() returns a variable of type Atype |
| ||
Function Foo%() returns an integer variable also! but its same without the %, its for neat freaks :P I use the % to tell if the function returns an integer at all! |