summaryrefslogtreecommitdiff
path: root/test_client.lua
diff options
context:
space:
mode:
authorLizzy Fleckenstein <lizzy@vlhl.dev>2026-06-01 22:25:56 +0200
committerLizzy Fleckenstein <lizzy@vlhl.dev>2026-06-01 22:25:56 +0200
commitb9e3ab8e8213efa260ff3b0030d2c399f3afc653 (patch)
treece8149a256c5c36dba3688cd7dee12bb4cde59a7 /test_client.lua
downloadr6p-b9e3ab8e8213efa260ff3b0030d2c399f3afc653.tar.xz
init
Diffstat (limited to 'test_client.lua')
-rwxr-xr-xtest_client.lua33
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)