Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function apiGet(page,args)
- local curposx, curposy = term.getCursorPos()
- if args then
- utd = page.."?"..args
- else
- utd = page
- end
- sp = string.find(utd,"/")
- if sp then
- if #utd > sp then
- domain = string.sub(utd,1,sp-1)
- pageOS = string.sub(utd,sp+1,#utd)
- else
- domain = string.sub(utd,1,sp-1)
- pageOS = "index"
- end
- else
- domain = utd
- pageOS = "index"
- end
- rednet.broadcast(pageOS,domain)
- RTID = os.startTimer(6)
- LSTID = os.startTimer(0.2)
- lps = #"Loading" +1
- write("Loading")
- loadloops = 0
- while true do
- e,side,chan,rchan,msg,dist = os.pullEvent()
- if e == "timer" and side == RTID then
- print("Could not connect to site.")
- return false
- elseif e == "timer" and side == LSTID then
- term.setCursorPos(-1+curposx+lps+loadloops,curposy)
- if loadloops ~= 3 then
- write(".")
- end
- loadloops = loadloops +1
- if loadloops == 4 then
- term.setCursorPos(curposx,curposy)
- write("Loading ")
- loadloops = 0
- end
- LSTID = os.startTimer(0.2)
- elseif e == "modem_message" and chan == os.getComputerID() then
- if msg["nRecipient"] == os.getComputerID() then
- term.setCursorPos(curposx,curposy)
- write(string.rep(" "),#"Loading...")
- term.setCursorPos(curposx,curposy)
- return msg["message"]
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment