lua-users home
lua-l archive

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


I'm using the attached file (butchered together from Steve Donovans
Penlight-library, mostly- but is has no dependencies) as Lua-init
script (you have to set the environment variable "LUA_INIT" to e.g.
"@F:\lua\utility\init.lua"). It makes the tostring- function act
differently if a table has no corresponding metafunction:

Usage: print uses tostring by default, so:
> print{1,2,'3'} --outputs:
table: 0x002cc2c8 {
  1,
  2,
  "3"
}

This is the most pragmatic solution IMHO, because you end up needing
something like this in almost every script (for debugging) anyway.

Having the output in a single line if its shorter than, say, 80
characters would be nice, but I didn't want to code that :P

--Wolfgang Pupp

Attachment: init.lua
Description: Binary data