Page 1 of 1

Return array from procedure?

Posted: Fri Jul 21, 2017 2:37 pm
by Smetad_Anarkist
How can I get array-data back from a procedure? I've read somewhere that I should give it back through input/output arguments or something like that?

Would anybody like to share an example?

Re: Return array from procedure?

Posted: Fri Jul 21, 2017 2:58 pm
by skywalk
http://www.purebasic.com/documentation/ ... dures.html

Code: Select all

;Example: Array as parameter
  Dim Table.Point(10, 15)
  Table(0,0)\x = 1
  Table(1,0)\x = 2
  Procedure TestIt(c.l, Array ParameterTable.Point(2))  ; The table support 2 dimensions
    ParameterTable(1, 2)\x = 3
    ParameterTable(2, 2)\x = 4
   EndProcedure
  TestIt(10, Table())
  MessageRequester("Table", Str(Table(1, 2)\x))