Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- test for net
- ]]--
- local function clear()
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.clear()
- term.setCursorPos(1,1)
- end
- local function testOne()
- clear()
- local win = net.newWindow()
- local files
- local path = {}
- local function sPath()
- return table.concat(path,"/")
- end
- local function newlist()
- local test,this = pcall(fs.list,sPath())
- return (this or {})
- end
- local function goBack()
- table.remove(path)
- files("set",newlist())
- end
- local function goForward(step)
- table.insert(path,step)
- files("set",newlist())
- end
- local function kill()
- win("kill")
- end
- files = net.listBox(win,newlist(),goForward,1,3,40,10,"lightGray","gray")
- net.button(win,"[back]",goBack,1,2,"lime","green")
- net.button(win,"[return]",kill,8,2,"lime","green")
- net.run(win)
- end
- local function testTwo()
- clear()
- local function testC(...)
- print("test C")
- print(...)
- error()
- end
- term.clear()
- term.setCursorPos(1,1)
- local win = net.newWindow()
- local list1 = net.listBox(win,{"option 1","options 2","options 3","options 4"},testC,2,6,10,10,"lightGray","gray")
- local list2 = net.listBox(win,{"option 1","options 2","options 3","options 4"},testC,13,6,10,10,"lightGray","gray")
- local list3 = net.listBox(win,{"option 1","options 2","options 3","options 4"},testC,24,6,10,10,"lightGray","gray")
- local list4 = net.listBox(win,{"option 1","options 2","options 3","options 4"},testC,35,6,10,10,"lightGray","gray")
- local function testA()
- list4("clear")
- end
- local function testB()
- list4("add","hello")
- end
- local function kill()
- win("kill")
- end
- local button1 = net.button(win,"[button1]",testA,2,2,"lime","green")
- local button2 = net.button(win,"[button2]",testB,2,4,"lime","green")
- net.button(win,"[button4]",kill,12,4,"lime","green")
- local button3 -- needs to be declared before chicken or egg probblem
- local count = 1
- local function testC()
- count = count + 1
- button3("set","[click "..tostring(count).."]")
- end
- button3 = net.button(win,"[button3]",testC,12,2,"lime","green")
- net.run(win)
- end
- local win = net.newWindow()
- local function kill()
- win("kill")
- end
- clear()
- net.button(win,"[button1]",testOne,2,2,"lime","green")
- net.button(win,"[button2]",testTwo,2,4,"lime","green")
- net.button(win,"[button3]",kill,2,6,"lime","green")
- net.run(win)
Advertisement
Add Comment
Please, Sign In to add comment