Blitz arrays can't be strings?

Blitz3D Forums/Blitz3D Programming/Blitz arrays can't be strings?

big10p(Posted 2005) [#1]
Hmm, I don't use blitz arrays very often - except as type fields - but it seems they can't be string arrays, for some reason. For example, doing 'Global name$[10]' in the main code, or 'Local name$[10]' inside a function compiles fine but then any assignment, like 'name$[1] = "Noddy"' causes a "Variable type mismatch" error. Is this a bug, or what? String arrays in types work fine. :/


Shambler(Posted 2005) [#2]
You need to use Dim mystring$() instead of Global mystring$[]


DJWoodgate(Posted 2005) [#3]
You have to leave off the $ or % or # when doing an assignment for some odd reason. Probably just a parsing issue which needs fixing, so yes it is a bugette and so is this, as the compiler should really complain.

Type any
Field a$[10]
End Type

a.any = New any

a\a#[1] = 123.45

Print a\a%[1]

WaitKey()


big10p(Posted 2005) [#4]
Ah, OK. Thanks DJW.