lua-users home
lua-l archive

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


2015-09-09 22:49 GMT+02:00 Soni L. <fakedme@gmail.com>:

> Why does table.concat not respect __concat? I wanted to
> make it error with a custom error message.

If you wish to experiment, `xtable` (see another recent thread)
offers such a function.

$ lua -l xtable
Lua 5.3.1  Copyright (C) 1994-2015 Lua.org, PUC-Rio
> help=xtable.help
> B=xtable.block
> help(B.concat)
---   concat(tbl,sep,first,last)
-- standard: second argument is used as a separator if a number or a string
-- extra: second argument is used as a filter if a function
-- nonstandard: `sep`=`nil` defaults to `tostring`, not to the empty string
-- extra: concatenation respects metamethods
-- missing: elegant workaround for stack overflow