Posted 21 March 2013 - 05:15 PM
Hi,
i have been working on this file program and its been giving me this weird bug that I can't track down. I feel I may have added a return in some where. every D.write() writes to a monitor to help me debug FYI. if I clicked on a file i should get :1:1.1:22:1.1:1: but insted I got :1:1.1:2 meaning the problem MAY be between line 50 and line 53, if that help you understand my debugging system.
PS: I'm sorry for the bad variable names and stuff i planed on making this just a quick program and I don't have time to add quotes. Sorry!
Thanks for you help!
i have been working on this file program and its been giving me this weird bug that I can't track down. I feel I may have added a return in some where. every D.write() writes to a monitor to help me debug FYI. if I clicked on a file i should get :1:1.1:22:1.1:1: but insted I got :1:1.1:2 meaning the problem MAY be between line 50 and line 53, if that help you understand my debugging system.
PS: I'm sorry for the bad variable names and stuff i planed on making this just a quick program and I don't have time to add quotes. Sorry!
local w,h = term.getSize()
local files = {}
local dir = {"/"}
local mun = {}
local sDir = ""
local D = peripheral.wrap("monitor_6")
local function drawGUIFiles(loco)
term.setTextColor(colors.black)
term.setBackgroundColor(colors.white)
term.clear()
term.setCursorPos(1,1)
term.setBackgroundColor( colors.lightGray )
term.clearLine()
write(loco.."/")
term.setCursorPos(w-1,1)
term.setBackgroundColor(colors.yellow)
write("^")
term.setBackgroundColor(colors.red)
print("x")
term.setBackgroundColor(colors.white)
files = fs.list(loco)
for i=1,#files do
if not fs.isDir(loco.."/"..files[i]) then
term.setTextColor(colors.red)
end
print(files[i])
term.setTextColor(colors.black)
end
term.setCursorPos(0,0)
end
local function combine(comInput)
local ret = ""
for i=1,#input do
comOutput = comOutput..comInput[i]
end
return ret
end
local function main()
while true do
D.write(":1")
XXX,botton,x,y = os.pullEvent("mouse_click")
D.write(":1.1")
if fs.isDir(files[y-1]) then
D.write(":2")
table.insert(dir,files[y-1])
sDir = combine(dir)
drawGUIFiles(sDir)
D.write("2:")
elseif y == 1 and x == w-1 then
D.write(":3")
if #dir ~= 1 then
D.write(":3.1")
table.delete(dir,#dir)
sDir = combine(dir)
drawGUIFiles(sDir)
D.write("3.1:")
end
D.write("3:")
elseif y == 1 and x == w then
D.write(":4")
term.setBackgroundColor(colors.black)
term.clear()
D.write("4:")
end
D.write("1.1:1:")
end
end
drawGUIFiles(sDir)
main()
Thanks for you help!