[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Suggestion for table.concat
- From: PA <petite.abeille@...>
- Date: Wed, 24 Oct 2007 18:42:30 +0200
On Oct 24, 2007, at 18:13, PA wrote:
Sure... roll your own... e.g.:
Alternatively... a more baroque approach could use a function
environment and therefore not require an additional argument, e.g.:
local function quote( aValue )
return ('%q'):format( tostring( aValue ) )
end
local t = { 'hi', 5, nil, 4, function() end, {} }
setfenv( concat, { encoder = quote } )
print( concat( t, ' ' ) )
> "hi" "5" "nil" "4" "function: 0x103dc0" "table: 0x103de0"
Attachment:
TestTable.lua
Description: Binary data