Commit 3668b45ee6f51655462e85950df0fd453830b5f2

Authored by dg
1 parent e24c425a

fix


git-svn-id: http://svn.net-core.org/repos/t-engine4@2868 51575b47-30f0-44d4-a5cc-537603b46e54
... ... @@ -96,7 +96,7 @@ function _M:loaded()
96 96 self:updateZoom()
97 97
98 98 -- Serialize arguments for passing into the particles threads
99   - local args = table.serialize(self.args or {})
  99 + local args = table.serialize(self.args or {}, nil, true)
100 100 args = args.."tile_w="..engine.Map.tile_w.."\ntile_h="..engine.Map.tile_h
101 101
102 102 self.update = fct
... ...
... ... @@ -75,20 +75,26 @@ end
75 75
76 76 --- This is a really naive algorithm, it will not handle objects and such.
77 77 -- Use only for small tables
78   -function table.serialize(src, sub)
  78 +function table.serialize(src, sub, no_G)
79 79 local str = ""
80 80 if sub then str = "{" end
81 81 for k, e in pairs(src) do
82 82 local nk, ne = k, e
83 83 local tk, te = type(k), type(e)
84 84
85   - if tk == "table" then nk = "["..table.serialize(nk, true).."]"
86   - elseif tk == "string" then nk = string.format("[%q]", nk)
87   - else nk = "["..nk.."]"
  85 + if no_G then
  86 + if tk == "table" then nk = "["..table.serialize(nk, true).."]"
  87 + elseif tk == "string" then -- nothing
  88 + else nk = "["..nk.."]"
  89 + end
  90 + else
  91 + if tk == "table" then nk = "["..table.serialize(nk, true).."]"
  92 + elseif tk == "string" then nk = string.format("[%q]", nk)
  93 + else nk = "["..nk.."]"
  94 + end
  95 + if not sub then nk = "_G"..nk end
88 96 end
89 97
90   - if not sub then nk = "_G"..nk end
91   -
92 98 if te == "table" then
93 99 str = str..string.format("%s=%s ", nk, table.serialize(ne, true))
94 100 elseif te == "number" then
... ...