Log In  

I don't know if this is expected behavior, but I thought I should ask:

Is it expected that stringifying the table var/ref will give different results when it has a (blank?) metatable attached?

P#109433 2022-03-30 18:59 ( Edited 2022-03-30 20:41)

It is not -- Fixed for 0.2.4c

This is Lua's standard tostring() output for tables, that is used when the table has a metatable AND __tostring is set on that table (that last condition was missing).

P#109500 2022-04-01 08:54

(The only reason for using a customised tostring() for printing tables was just that those hex address strings are usually not of interest and super ugly in 128x128, heh)

P#109501 2022-04-01 08:57

unless we could poke these addresses 😜

P#109502 2022-04-01 09:55

I tried going down that rabbithole for Picotron, and it's not pretty!

Or at least, I couldn't find a nice way to make it work.

P#109503 2022-04-01 10:21

Addresses at least let us check if some table is the same as another one. That is useful when you don’t have other means of debugging yet (like custom tostr function).

P#109505 2022-04-01 10:54 ( Edited 2022-04-04 14:27)
2

You can still get the address with tostr(tbl,1) (it's not very obvious -- I should add some examples to the manual)

> ?tostr(print,1)
function: 0x2b31195c
> ?tostr({},1)
table: 0x80e5d9c
> ?tostr({},1)
table: 0x80efa3c
P#109518 2022-04-01 14:23

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-28 18:54:39 | 0.008s | Q:19