Home | History | Annotate | Download | only in lua
      1 function 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
     19 end
     20 
     21 function sk_scrape_startcanvas(c, fileName) end
     22 
     23 function sk_scrape_endcanvas(c, fileName) end
     24 
     25 local effects = {}
     26 
     27 function count_fields(t)
     28     for k, v in next, t do
     29         effects[k] = (effects[k] or 0) + 1
     30     end
     31 end
     32 
     33 local total_paints = 0;
     34 
     35 function sk_scrape_accumulate(t)
     36     if (t.paint) then
     37         total_paints = total_paints + 1
     38         count_fields(t.paint:getEffects())
     39     end
     40 end
     41 
     42 function sk_scrape_summarize()
     43     io.write("total paints ", total_paints, " ", tostr(effects), "\n");
     44 end
     45 
     46