-
Notifications
You must be signed in to change notification settings - Fork 86
Expand file tree
/
Copy pathlua_client.lua
More file actions
47 lines (32 loc) · 853 Bytes
/
lua_client.lua
File metadata and controls
47 lines (32 loc) · 853 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
require("testmsg")
event_init()
-- create server
client = NetClient:new()
client.on_connect = function(conn)
print("on onnect")
end
client.on_close = function(conn)
print("close")
end
client.on_msg = function(conn, msgtype, pack)
msg = testmsg:new();
msg:read(pack);
print("id:"..msg.id);
print("play.name :" .. msg.play.name);
print("play.level:" .. msg.play.level);
print("play.msgcount:".. msg.play.msgcount);
for i = 1, #msg.array, 1 do
print("array: " .. msg.array[i]);
end
for i = 1, #msg.attrs, 1 do
print(i.. " attack:" ..msg.attrs[i].attack);
print(i.. " hp:" .. msg.attrs[i].hp);
end
for i = 1, #msg.vstr, 1 do
print("vstr: " .. msg.vstr[i]);
end
print("----------------------------------------");
conn:sendPacket(1, pack)
end
client:connect("127.0.0.1", 3001, false);
event_run()