lua-users home
lua-l archive

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


On Sun, Jul 1, 2012 at 5:13 PM, Dimitris Papavasiliou <dpapavas@gmail.com> wrote:
> Thats really nice. It would be nice if the pretty printer could try calling
> __tostring' on  stuff it doesnt understand (c types) in the hope of getting
> a printable version.

It already does that, doesn't it?  Try this for example:

>  f = io.open ("/usr/bin/lua")
>  f
file (0xc229f0)
>  f:close()
true


OK, they were LuaJIT cdata items, which it thinks are blank, and doesnt call __tostring or print cdata when it prints them in a table, only on their own:

>  w.inet6[1].addr
  addr = ,
  cacheinfo = ,
  ifaddr = ,
}
>  tostring(w.inet6[1].addr)
"2001:460:1f09:1a62:dd55:27b5:d001:a421"
>  type(w.inet6[1].addr)
"cdata"
>  w.inet6[1].addr
"cdata"

It would be nice if it called __tostring for these.

Justin