Problem 'Type'

BlitzMax Forums/BlitzMax Beginners Area/Problem 'Type'

Smokey(Posted 2005) [#1]
Hi all

I have a problem with my type

Type GroupSlang
Field Bad$
Field good$
EndType

Global Slangs:GroupSlang[125]

For a = 0 To 124
Slangs[a] = New GroupSlang
Slangs[a] .Bad$=1
Slangs[a] .good$=2
Next

' my code work, but I use Global Slangs:GroupSlang[125]

so my var Slangs is suppose to be available uppon function I made ?

If I go into a function it seem that I lost the value of my var Slangs


WendellM(Posted 2005) [#2]
Exactly how are you using Slangs in your function? It works here:
Type GroupSlang
	Field Bad$
	Field good$
EndType

Global Slangs:GroupSlang[125]

For a = 0 To 124
	Slangs[a] = New GroupSlang
	Slangs[a].Bad$ = 1
	Slangs[a].good$ = 2
Next

PrintSlangs

Function PrintSlangs()
	For i = 10 To 15
		Print Slangs[i].bad
		Print Slangs[i].good
	Next
End Function
which produces the expected:

1
2
1
2
1
2
1
2
1
2
1
2