23.04.2020, 05:07
It does not work because you've set the result to variable with the same name as the function. So ping is no longer a function but boolean variable.
Another thing is that if/else is not needed, you can pass the result directly to checkwrite:
Another thing is that if/else is not needed, you can pass the result directly to checkwrite:
Code:
function ping(ip)
local res = os.execute('ping -c 2 -W 5 ' .. ip)
return res == 0
end
res = ping('192.168.45.1')
grp.checkwrite('11/0/1', res)