basic_robot/scripts/programming/serialize.lua

13 lines
308 B
Lua

local serialize = function(tab) -- helper function
local out = {};
for k,v in pairs(tab) do
if type(v)~= "table" then
out[#out+1] = ""..k .." = " ..v
else
out[#out+1] = ""..k .. " = " .. serialize(v)
end
end
return "{"..table.concat(out,", ").."}"
end