1
0
mirror of https://github.com/XeonSquared/OC-Copper.git synced 2024-11-14 22:08:05 +11:00
OC-Copper/oc/app/ping.lua

23 lines
600 B
Lua
Raw Normal View History

-- I, 20kdc, release this into the public domain.
-- No warranty is provided, implied or otherwise.
local occure = require("occure")
local computer = require("computer")
local event = require("event")
local args = {...}
local startTime = computer.uptime()
local completed = 0
for _, v in ipairs(args) do
occure.output(v, 0, "", false, function ()
print("Ping response from " .. v .. " @ " .. (computer.uptime() - startTime))
completed = completed + 1
end, function ()
print("Gave up trying to ping " .. v)
completed = completed + 1
end)
end
while completed < #args do
event.pull(5)
end