Reply -
Raw
local data={["test"]={["foobar"]=[[foo
bas
]],["asdf"]=[[sdf
]],["test2"]={["qwer"]=[[asd
]]}}}
local function extract(be, p)
if p == nil then
p = ""
end
if not fs.exists(p) then
fs.makeDir(p)
end
for n,e in pairs(be) do
local ep = fs.combine(p, n)
if type(e) == "table" then
print(ep .. "/")
if fs.exists(ep) then
error("Path exists on filesystem: " .. ep .. "/")
end
extract(e, ep)
else
print(ep)
if fs.exists(ep) then
error("Path exists on filesystem: " .. ep)
end
local fh = fs.open(ep, "w")
fh.write(e)
fh.close()
end
end
end
extract(data, ({...})[1])