Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local program = shell.getRunningProgram()
- local tArg = {...}
- if not tArg[1] then
- print("Usage: "..program.." fileName")
- return
- end
- if fs.exists(tArg[1]) then
- local file = fs.open(tArg[1],"r")
- local tBlueprint = {}
- local tColorSlots = {}
- local tOrigin = {}
- if file.readLine() == "Blueprint file for CometWolf's Turtle Architect. Pastebin: Kt4D8uyE" then
- tBlueprint = textutils.unserialize(file.readLine())
- local colors = file.readLine()
- if colors then
- tColorSlots = textutils.unserialize(colors)
- end
- end
- file.close()
- if tBlueprint and #tBlueprint > 0 then
- local file = fs.open(tArg[1],"w")
- file.writeLine("Blueprint file for CometWolf's Turtle Architect. Pastebin: Kt4D8uyE")
- for layer=1,#tBlueprint do
- file.writeLine("Layer "..layer.." :")
- tBlueprint[layer] = tBlueprint[layer] or {}
- for x=1,#tBlueprint[layer] do
- local line = "X"..x..string.rep(" ",#string.format(#tBlueprint[layer])-#string.format(x))..": "
- for z=1,#tBlueprint[layer][x] do
- local block = tBlueprint[layer][x][z] or "0"
- line = line..block..string.rep(" ",3-#string.format(block))
- end
- file.writeLine(line)
- end
- end
- file.writeLine"Color slots table:"
- file.writeLine(textutils.serialize(tColorSlots))
- file.writeLine"Build origin data:"
- file.writeLine(textutils.serialize(tOrigin))
- file.close()
- print("Sucessfully converted :"..tArg[1])
- return
- end
- end
- error("Invalid file: "..tArg[1])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement