Feature request: B3D's Str function

BlitzMax Forums/BlitzMax Programming/Feature request: B3D's Str function

Hi,

In B3D you could convert a type-instance to a string, using the Str function:
' B3D code:
Type test
	Field SomeNum%
	Field SomeText$
End Type

testa.test = New test

testa\SomeNum = 5
testa\SomeText = "Hello"

Print Str testa
WaitKey()

This would print: "[5,"Hello"]".

This could be used to compare objects and remove objects that have identical values inside their fields.

' B3D code:
Type test
	Field SomeNum%
	Field SomeText$
End Type

testa.test = New test
testb.test = New test

testa\SomeNum = 5
testa\SomeText = "Hello"

testb\SomeNum = 6
testb\SomeText = "Hello"

Print Str testa
Print Compare(testa, testb)
WaitKey()

Function Compare(o1.test, o2.test)
	o3$ = Str o1
	o4$ = Str o2

	If o3 = o4 Then Return True Else Return False
End Function


Right now we have to write our own Compare method and change it when there's a new field added to a type.