i am not aware of lua script but i need some help. Basically current lua script will receive structure. in those structure has address parameter where will get two index parameters(ipv6 & ipv4) addresses.
lua script need to implement below case
- ping ipv6 address and result will get store in local variable. if local variable gets (ping success) will connect/call uv.tcp_connect for passed ipv6 address. otherwise i will check the same for ipv4 address and try to connect/call uv.tcp_connect.
To store output of system commands i suggest
io.popen().An example for conditional ping that tries first IPv6 and if fail IPv4...
...typed in a Lua console.
EDIT
Online Lua Environments dont support above code!