Function that returns a type

Blitz3D Forums/Blitz3D Programming/Function that returns a type

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

There will be no memory leak. The variable pff which references the instance will be lost outside the function. By creating a new coo instance you are effectively adding this to a global type list, regardless of whether it's inside or outside the function.

So, in your example you are actually creating 2 x instances, one outside the function and one inside. This is the correct way to do it ...

Type coo
	Field a
	Field b
End Type

test.coo = jack(1,2)
Print test\a
Print test\b
WaitKey()
End