D DPaul Active Member Licensed User Longtime User Sep 6, 2016 #1 Hi, I am using a list. After a certain event, i list.add(a type). The type has several components, such as .who, .where...etc Then i log(list.get(....)) All this works fine. Questions: 1. The log seperates the components (in some order) with a comma, that i did not put there, is that automatic ? In other words, the list sees the type components as individual elements ? 2. At the end of the list-record it puts an extra component "isInitialised = false". What is the meaning of that? 3. At closer inspection, the elements of the type are not logged in the same order as they have been "Dim" med. Is that randon ? Thanks Paul Last edited: Sep 6, 2016
Hi, I am using a list. After a certain event, i list.add(a type). The type has several components, such as .who, .where...etc Then i log(list.get(....)) All this works fine. Questions: 1. The log seperates the components (in some order) with a comma, that i did not put there, is that automatic ? In other words, the list sees the type components as individual elements ? 2. At the end of the list-record it puts an extra component "isInitialised = false". What is the meaning of that? 3. At closer inspection, the elements of the type are not logged in the same order as they have been "Dim" med. Is that randon ? Thanks Paul
eurojam Well-Known Member Licensed User Longtime User Sep 6, 2016 #2 DPaul said: 2. At the end of the list-record it puts an extra component "isInitialised = false". What is the meaning of that? Click to expand... you have defined your own type without initializing it....this will raise an error if you will have an array withing your own type like: B4X: Expand Collapse Copy Type testtype ( name As String, numbers(10) As Int) If you only have numbers and strings in your type, it doesn't matter ... Upvote 0
DPaul said: 2. At the end of the list-record it puts an extra component "isInitialised = false". What is the meaning of that? Click to expand... you have defined your own type without initializing it....this will raise an error if you will have an array withing your own type like: B4X: Expand Collapse Copy Type testtype ( name As String, numbers(10) As Int) If you only have numbers and strings in your type, it doesn't matter ...
D DPaul Active Member Licensed User Longtime User Sep 6, 2016 #3 eurojam said: you have defined your own type without initializing it....this will raise an error if you will have an array withing your own type like: B4X: Expand Collapse Copy Type testtype ( name As String, numbers(10) As Int) If you only have numbers and strings in your type, it doesn't matter ... Click to expand... You are right, it did not matter, but I initialised it anyway. Still puzzled why it logs the "type"-elements in a seemingly random order. B4a also says that i add the same object to the list more than once. ? Same type, elements have different values? Seems no showstopper. Paul Upvote 0
eurojam said: you have defined your own type without initializing it....this will raise an error if you will have an array withing your own type like: B4X: Expand Collapse Copy Type testtype ( name As String, numbers(10) As Int) If you only have numbers and strings in your type, it doesn't matter ... Click to expand... You are right, it did not matter, but I initialised it anyway. Still puzzled why it logs the "type"-elements in a seemingly random order. B4a also says that i add the same object to the list more than once. ? Same type, elements have different values? Seems no showstopper. Paul
Erel B4X founder Staff member Licensed User Longtime User Sep 6, 2016 #4 DPaul said: Still puzzled why it logs the "type"-elements in a seemingly random order. Click to expand... You shouldn't rely on the output string. This is just used for debugging. If you want to convert it to a string in any specific format then you need to do it yourself. DPaul said: B4a also says that i add the same object to the list more than once. Click to expand... Sounds like a bug in your code. See the common mistake explained here: https://www.b4x.com/android/forum/threads/variables-objects-in-basic4android.8385/#content Upvote 0
DPaul said: Still puzzled why it logs the "type"-elements in a seemingly random order. Click to expand... You shouldn't rely on the output string. This is just used for debugging. If you want to convert it to a string in any specific format then you need to do it yourself. DPaul said: B4a also says that i add the same object to the list more than once. Click to expand... Sounds like a bug in your code. See the common mistake explained here: https://www.b4x.com/android/forum/threads/variables-objects-in-basic4android.8385/#content
D DPaul Active Member Licensed User Longtime User Sep 6, 2016 #5 Good show. Made my own output string, and the warning went away by itself ! Upvote 0