diff --git a/README.md b/README.md index 1de57e9..420bcc1 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,7 @@ Similar to `pcall` and `loadstring` calls, `load` returns status as the first va * numformat (string; "%.17g") -- specify format for numeric values (shortest possible round-trippable double) * valignore (table) -- allows to specify a list of values to ignore (as keys) * keyallow (table) -- allows to specify the list of keys to be serialized. Any keys not in this list are not included in final output (as keys) +* keyignore (table) -- allows to specity the list of keys to ignore in serialization. * valtypeignore (table) -- allows to specify a list of value *types* to ignore (as keys) * custom (function) -- provide custom output for tables * name (string) -- name; triggers full serialization with self-ref section diff --git a/src/serpent.lua b/src/serpent.lua index dabfe95..ca52392 100644 --- a/src/serpent.lua +++ b/src/serpent.lua @@ -1,4 +1,4 @@ -local n, v = "serpent", 0.284 -- (C) 2012-15 Paul Kulchenko; MIT License +local n, v = "serpent", 0.285 -- (C) 2012-15 Paul Kulchenko; MIT License local c, d = "Paul Kulchenko", "Lua serializer and pretty printer" local snum = {[tostring(1/0)]='1/0 --[[math.huge]]',[tostring(-1/0)]='-1/0 --[[-math.huge]]',[tostring(0/0)]='0/0'} local badtype = {thread = true, userdata = true, cdata = true} @@ -70,6 +70,7 @@ local function s(t, opts) local value, ktype, plainindex = t[key], type(key), n <= maxn and not sparse if opts.valignore and opts.valignore[value] -- skip ignored values; do nothing or opts.keyallow and not opts.keyallow[key] + or opts.keyignore and opts.keyignore[key] or opts.valtypeignore and opts.valtypeignore[type(value)] -- skipping ignored value types or sparse and value == nil then -- skipping nils; do nothing elseif ktype == 'table' or ktype == 'function' or badtype[ktype] then