I've just purchased BMax (v.14) and have gotten an error I have never seen before when I use superstrict, and I try to add a number to a tlist I get the following error:
"Unable to convert int to object"
I never saw this when I used the demo version. So can I no longer add integers to tlists, or is there a way round this?
well, one way I can think of, off the top of my head is to create a holding type:
Type TInt
Field val:Int
End Type
I tried the following
Strict
Local List:tlist = CreateList()
Type test
Field t:Int
End Type
Local t:Test = New test
t.t = 30
List.AddLast t.t
And I still get the same error.
The simplest method is to use String as the container for ints in a list:
SuperStrict
Local list:tlist=New tlist
Local t:Int=40
list.addlast String(t)
list.addlast String(30)
For Local s$=EachIn list
t=Int(s$)
Print t
Next
And Int is not an object so you can make a wrapper class like Perturbatio said or put it into some other type that is an object like a string. In Java all of the basic types (int, float, boolean, etc.) have a corresponding class (Integer, Float, Boolean, etc.) that contain functions to deal with things like conversions, and they also act as a wrapper class to be used as an object.
The simplest method is to use String as the container for ints in a list:
Except then they get sorted wrongly.