How are you writing the DB? This code works for me:
s = bin.pack('SSS', {'a', 'b', bin.pack('BBB', {1, 2, 3})})
db = io.open('db:/testdb', 'w')
db:openrec(db:createrec(string.len(s)))
db:closerec()
db:close()
........
db = io.open('db:/testdb', 'r')
db:openrec(0) --I used Bird to find out I had created record #0
s = db:read('*a')
db:closerec()
db:close()
t2 = bin.unpack('SSS', s)
t1 = bin.unpack('BBB', t2[3])
And I got the original tables back. I also tried this with a stream
database (just omit the createrec, openrec, and closerec lines) and it
worked just the same. This is Plua 2.0b10 on a Zire 31.
I have a feeling somehow your problem has to do with embedded nulls in
the datatowrite string (put there by bin.pack(SSS)), but that's just a
guess.
krakenarm krakenarm-at-yahoo.de |plua| wrote:
>
> Hiho.. ive tried to pack a table into a table.
> after a few misses i got the idea:
> t1={1,2,3}
> intertable= bin.pack("BBB", t1)
> t2={"a", "b", intertable}
> datatowrite= bin.pack("SSS", t2)
>
> no problems here.. no errors returned while writing datatowrite into
> the DB,
> but now i try to open them:
>
> t2= bin.unpack("SSS", dataread)
> t1= bin.unpack("BBB", t2[3])
>
> but t1 is not my table t1 it is nil.
>
> I tried the openmodes in binary and normal mode... got the same results.
>
>
[Non-text portions of this message have been removed]