[Gambas-user] gb3: clearing a public embedded array from a procedure
gambas at ...1...
Tue Jul 5 02:25:53 CEST 2011
> I've declared an array like this:
> Public QueueObject As String
> and tried to clear it in a procedure like this:
> but receive the error "Embedded array...".
> I just need to erase all the values in the array so I can reassign new
> ones. Obviously I can do this manually, but it looked like the .Clear
> method would do the trick. Any idea why it is throwing this error?
> I looked over the documentation here:
> and see that there are local arrays and embedded arrays. I guess some or
> all array methods are only available for local arrays? The docs are a
> bit confusing to me on this, but it's probably because I'm out of my
> depth. I can otherwise read and write to the array normally from the
> procedure, and do a function such as "QueueSorted =
Embedded arrays are not Gambas object, their memory is allocated directly
inside the object where they are declared.
So you can't use Clear(), as that method resizes the array to zero elements.
If you don't want to be confused, just use normal arrays:
Public QueueObject As New String
More information about the User