aboutsummaryrefslogtreecommitdiff
path: root/spec/server/init.lua
blob: f895ba3e3076c20823bdae9ef6904d360a130386 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
			local has_ponged = false
			local socket  = net.newsocket(net.PAIR)
			socket:bind("tcp://127.0.0.1:5555")
			function socket:receive(stream)
				print("Socket receive triggered")
				has_ponged = true
				local message = stream:readstring()
				assert(message == "ping")
				socket:send(function(stream2)
					stream2:writestring("pong")
				end)
			end
			function GAME.tick()
				if has_ponged then
					GAME.exit()
				end
			end
		

GAME.exit()