[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

When Writing then reading a multi dim array it is changed to single dim array


if I have a multi dimensional array and write it as an object, then read it back it becomes a single dimensional array.

The number of entries remain the same, just the dimensions are lost.

I don't know if this a bug or a feature?

sample script

-----------------------------------------------------

#!/usr/bin/env gbs3

Dim a As New Integer[5, 5, 5]
Dim b As Integer[]

Dim x As Pointer = Alloc(5000)
Dim mfile As File

mfile = Memory x For Write
Write #mfile, a As Object
Close mfile

mfile = Memory x For Read
b = Read #mfile As Object

Print Subst("Before saving array  count=&1, Dim=&2", a.count, a.dim)
Print Subst("After reading array  count=&1, Dim=&2", b.count, b.dim)   ' they don't match

Quit 0
Catch
Error "Script Error >";; error.text & "\n" & error.where

------------------------------------------------------------------------------------------

--
~~~~ Brian

Attachment: OpenPGP_0x78BFB26402F48419.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


Follow-Ups:
Re: When Writing then reading a multi dim array it is changed to single dim arrayJussi Lahtinen <jussi.lahtinen@xxxxxxxxx>