diff options
Diffstat (limited to 'test_client.lua')
| -rwxr-xr-x | test_client.lua | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test_client.lua b/test_client.lua new file mode 100755 index 0000000..aac6fe6 --- /dev/null +++ b/test_client.lua @@ -0,0 +1,33 @@ +#!/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) |
