Return Array From Function
BlitzMax Forums/BlitzMax Beginners Area/Return Array From Function| 
 | ||
| Is it possible to return an entire array within a function C++ style? Something like this:- Graphics 640,480 Global arse[3] arse[0] = 0 arse[1] = 0 arse[2] = 0 Function moo() Local moopface[3] moopface[0] = 2 moopface[1] = 67 moopface[2] = 4 Return moopface End Function arse = moo() Repeat Cls DrawText arse[0], 10,10 DrawText arse[1], 10,25 DrawText arse[2], 10,40 Flip FlushMem Until KeyDown(KEY_ESCAPE) Thanks :) | 
| 
 | ||
| I don't own BlitzMax, but I'm pretty sure you can. Like the variable names! Ryan | 
| 
 | ||
| An example in the spirit of things... size = 10 Local MyPants [size] MyPants = GetPants (size) For a = 0 Until size Print MyPants [a] Next ' The [] after the name denotes the function returns an array... Function GetPants [] (num) Local Pants [num] For a = 0 Until Len (Pants) Pants [a] = a Next Return Pants End Function | 
| 
 | ||
| PANTASTIC! ;) Cheers James. |