diff --git a/game/engines/default/engine/Particles.lua b/game/engines/default/engine/Particles.lua index 907e9849429d9a3acdd43a8d48ac0f4fa81f4c95..d4f613d14573b3c9b50ce70bd6eba21772362034 100644 --- a/game/engines/default/engine/Particles.lua +++ b/game/engines/default/engine/Particles.lua @@ -96,7 +96,7 @@ function _M:loaded() self:updateZoom() -- Serialize arguments for passing into the particles threads - local args = table.serialize(self.args or {}) + local args = table.serialize(self.args or {}, nil, true) args = args.."tile_w="..engine.Map.tile_w.."\ntile_h="..engine.Map.tile_h self.update = fct diff --git a/game/loader/pre-init.lua b/game/loader/pre-init.lua index c5c759fc5f2eb06f74e5cb109244f48cc424dff0..5ee513e3a153d64a10b375db31a7e73a02956e2b 100644 --- a/game/loader/pre-init.lua +++ b/game/loader/pre-init.lua @@ -75,20 +75,26 @@ end --- This is a really naive algorithm, it will not handle objects and such. -- Use only for small tables -function table.serialize(src, sub) +function table.serialize(src, sub, no_G) local str = "" if sub then str = "{" end for k, e in pairs(src) do local nk, ne = k, e local tk, te = type(k), type(e) - if tk == "table" then nk = "["..table.serialize(nk, true).."]" - elseif tk == "string" then nk = string.format("[%q]", nk) - else nk = "["..nk.."]" + if no_G then + if tk == "table" then nk = "["..table.serialize(nk, true).."]" + elseif tk == "string" then -- nothing + else nk = "["..nk.."]" + end + else + if tk == "table" then nk = "["..table.serialize(nk, true).."]" + elseif tk == "string" then nk = string.format("[%q]", nk) + else nk = "["..nk.."]" + end + if not sub then nk = "_G"..nk end end - if not sub then nk = "_G"..nk end - if te == "table" then str = str..string.format("%s=%s ", nk, table.serialize(ne, true)) elseif te == "number" then