mirror of
https://github.com/Reuh/anselme.git
synced 2025-10-27 16:49:31 +00:00
Don't expose private event fields to user in choices
This commit is contained in:
parent
7105b445ef
commit
7433d27da5
2 changed files with 16 additions and 22 deletions
16
test/run.lua
16
test/run.lua
|
|
@ -21,20 +21,6 @@ local function format_text(t)
|
|||
return r
|
||||
end
|
||||
|
||||
--- remove unneeded things from a result table (namely private fields)
|
||||
local function strip(t, visited)
|
||||
visited = visited or {}
|
||||
for k, v in pairs(t) do
|
||||
if type(k) == "string" and k:match("^_") then
|
||||
t[k] = nil
|
||||
end
|
||||
if type(v) == "table" and not visited[v] then
|
||||
visited[v] = true
|
||||
strip(v, visited)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function compare(a, b)
|
||||
if type(a) == "table" and type(b) == "table" then
|
||||
for k, v in pairs(a) do
|
||||
|
|
@ -214,8 +200,6 @@ else
|
|||
table.insert(result, { "error", err })
|
||||
end
|
||||
|
||||
strip(result)
|
||||
|
||||
if args["write-all"] then
|
||||
write_result(filebase, result)
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue