lua-users home
lua-l archive

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



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