blob: 5bd489977e4150298d6cac4c5a16db773b8d2874 [file] [log] [blame]
reed@google.com29563872013-07-10 21:23:49 +00001function tostr(t)
2 local str = ""
3 for k, v in next, t do
4 if #str > 0 then
5 str = str .. ", "
6 end
7 if type(k) == "number" then
8 str = str .. "[" .. k .. "] = "
9 else
10 str = str .. tostring(k) .. " = "
11 end
12 if type(v) == "table" then
13 str = str .. "{ " .. tostr(v) .. " }"
14 else
15 str = str .. tostring(v)
16 end
17 end
18 return str
19end
20
21function sk_scrape_startcanvas(c, fileName) end
22
23function sk_scrape_endcanvas(c, fileName) end
24
25local effects = {}
26
27function count_fields(t)
28 for k, v in next, t do
29 effects[k] = (effects[k] or 0) + 1
30 end
31end
32
33local total_paints = 0;
34
35function sk_scrape_accumulate(t)
36 -- dump the params in t, specifically showing the verb first, which we
37 -- then nil out so it doesn't appear in tostr()
38 io.write(t.verb, " ")
39 t.verb = nil
40 if (t.paint) then
41 total_paints = total_paints + 1
42 count_fields(t.paint:getEffects())
43 end
44 io.write(tostr(t), "\n")
45end
46
47function sk_scrape_summarize()
48 io.write("total paints ", total_paints, " ", tostr(effects), "\n");
49end
50