Hi,
Is there a way to make a function return a custom type ?
For example :
type point
int x, y;
end
type rect
int x0, x1, y0, y1;
end
function rect return_rect(point p1, point p2)
private
rect return_rect;
begin
return_rect.x0 = p1.x;
return_rect.y0 = p1.y;
return_rect.x1 = p2.x;
return_rect.y1 = p2.y;
return return_rect;
end
This code give me this error :
Quoteerror: Struct required ( token error: ")" ).
Any idea ?
(I doubt this is possible.)
Maybe if you use declare? It works on strings. In your case, you could do a work around by creating a global struct to output the values into. I know it's not elegant, but that can surely be done.
you can't return custom types... only can return pointers to custom types.
Thanks for your answers !