I am now using type functions and methods to do things, and have come across a problem. When I call my type.CreateType function, I do a check inside to determine whether or not I actually want to create the type. If the check passes, I return the type, If not, I am creating a dummy type that is immediately deleted. I've tried returning Null instead, but that crashes whenever I go to remove it. Is there a way to cancel the addition to my list after I've already called AddLast?
Example:
Type myType
Field X, Y
Function CreateType:myType()
If Rand(1, 2) = 1 then
Local m:myType = New myType
Return m
else
' What can I return at this point that
' will not cause a crash when I go
' through my list, besides creating a
' dummy type that is marked for deletion.
endif
End Function
End Type
typeList.AddLast myType.CreateType()
|