the list is arased when going out of the sub

danoptic

Member
Licensed User
Longtime User
when I finish the sub the list is erased even that i defined it in process globals
I copied the relevant lines

Sub
Process_GlobalsDim gamesListInfo AsList


Dim parser AsJSONParser
parser.Initialize(JSONString)
m = parser.NextObject
gamesListInfo = m.Get(
"root")

m.Clear
For i = 0To gamesListInfo.Size - 1
m = gamesListInfo.Get(i)
gamesListView.AddSingleLine2(m.Get(
"Game_Name") & " Exercise",m.Get("Game_Name"))
m.Clear
Next
 

eps

Expert
Licensed User
Longtime User
when I finish the sub the list is erased even that i defined it in process globals
I copied the relevant lines

Sub Process_GlobalsDim gamesListInfo AsList


Dim parser AsJSONParser
parser.Initialize(JSONString)
m = parser.NextObject
gamesListInfo = m.Get("root")

m.Clear
For i = 0To gamesListInfo.Size - 1
m = gamesListInfo.Get(i)
gamesListView.AddSingleLine2(m.Get("Game_Name") & " Exercise",m.Get("Game_Name"))
m.Clear
Next

Did you mean to have m.Clear in there?
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
You need to add items to a list so it should be gamesListInfo.add(m.Get("root")) or addall if m.Get("root") returns a list, otherwise you are copying pointers and when you do m.clear, you are effectively clearing gamesListInfo as well.
 
Last edited:
Upvote 0
Top