View difference between Paste ID: 5jEvjbpu and x3AEjJtd
SHOW: | | - or go back to the newest paste.
1
local sides = {}
2
side = ""
3
type = ""
4
5
function readTab(t)
6
	for i,v in pairs(t) do
7
		print(i,": ",v)
8
	end
9
end
10
11
--if not in sides then delete the directory
12
--run code from directory directly
13-
--make random spaces go away
13+
--
14
15
for _,v in pairs(peripheral.getNames()) do
16
	if v then
17
		side = v
18
		type = peripheral.getType(v)
19
		fs.makeDir(type)
20
		for i,v in pairs(peripheral.getMethods(v)) do
21
			local fileName = i
22
			local methodData = v
23
			local h = fs.open(type.."/"..v,"w")
24
			h.writeLine("--"..type)
25-
			h.writeLine("local args = ...")
25+
			h.writeLine("local tArgs = {...}")
26
			h.writeLine([[local p = peripheral.wrap("]]..side..[[")]])
27-
			h.writeLine("p."..v.."(args)")
27+
			h.writeLine("p."..v.."(table.concat(tArgs,\" \"))")
28-
			h.flush()
28+
			h.close()
29
		end
30
	end
31
end