Changed function order to avoid implicit declarations
fixed compile flags and typos in lua wrappers
changed error handling for readPing and included a lua networking library