[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: First impressions and errata
- From: "Gary V. Vaughan" <gary@...>
- Date: Mon, 24 Feb 2014 10:40:56 +1300
Hi Anders,
On Feb 23, 2014, at 1:38 PM, Anders Petersson <andpet@gmail.com> wrote:
> I'm surprised there's no built-in function to print the contents of a table. I looked at lua-stdlib [2] but it doesn't define such a function either.
Stdlib actually includes a programmable pretty-printer[1], with two instantiations [2][3], as demonstrated below:
$ lua
Lua 5.2.3 Copyright (C) 1994-2013 Lua.org, PUC-Rio
> =coroutine
table: 0x7f89c2d01270
> require 'std'
> =coroutine
{create=function: 0x109c78c5f,resume=function: 0x109c78caa,running=function: 0x109c78d33,status=function: 0x109c78d57,wrap=function: 0x109c78e3f,yield=function: 0x109c78e6d}
> =prettytostring(coroutine)
{
create = function: 0x109c78c5f,
resume = function: 0x109c78caa,
running = function: 0x109c78d33,
status = function: 0x109c78d57,
wrap = function: 0x109c78e3f,
yield = function: 0x109c78e6d,
}
[1] http://rrthomas.github.io/lua-stdlib/modules/std.string.html#render
[2] http://rrthomas.github.io/lua-stdlib/modules/std.string.html#tostring
[3] http://rrthomas.github.io/lua-stdlib/modules/std.string.html#prettytostring
Cheers,
--
Gary V. Vaughan (gary AT vaughan DOT pe)
Attachment:
signature.asc
Description: Message signed with OpenPGP using GPGMail