I'm a terrible beginner:
f = io.popen("ping -c 2 -t 5 192.168.0.1")
l = f:read("*a")
f:close()
if f==0 then print ("active")
else print ("off")
end
local f = io.popen("ping -c 2 -t 5 192.168.0.1")
local l = f:read("*a")
f = f:close()
if f then print ("active") else print ("off") end