lua-users home
lua-l archive

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

Hi Anders,

On Feb 23, 2014, at 1:38 PM, Anders Petersson <> 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, 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,


Gary V. Vaughan (gary AT vaughan DOT pe)

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail