#!/usr/bin/env lua5.1 local client = require("client") local invite = assert(arg[1]) local clt = client.join(invite) local started while true do client.update(clt) local status = client.status(clt) if status == "timeout_match" then print("failed to connect to match server") break elseif status == "fail_match" then print("game not found (invalid invite?)") break elseif status == "timeout_server" then print("failed to connect to server") break elseif status == "fail_server" then print("incorrect secret (invalid invite?)") break elseif status == "disco" then print("lost connection to server") break elseif status == "active" and not started then started = true print("connected to " .. tostring(clt.server)) end end client.close(clt)