From 9ef35b788ad90df31c835cb87e30ac943afbc9b7 Mon Sep 17 00:00:00 2001 From: HimbeerserverDE Date: Sun, 23 Jan 2022 17:56:53 +0100 Subject: [PATCH] Nested array demo --- cs_example.c | 10 +++++++++- types.dnet | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/cs_example.c b/cs_example.c index 398033e..ea63276 100644 --- a/cs_example.c +++ b/cs_example.c @@ -28,7 +28,11 @@ static void handle_pingpacket(DragonnetPeer *p, PingPacket *ping) dragonnet_peer_send_PongPacket(p, &(PongPacket) { .number = 0xdba, - .num_array = {0xd, 0xba} + .num_array = {0xd, 0xba}, + .nested_array = { + {0xd, 0xba}, + {0x13, 0x37} + } }); dragonnet_listener_close(l); @@ -44,6 +48,10 @@ static void handle_pongpacket(DragonnetPeer *p, PongPacket *pong) printf("PongPacket number: 0x%08x\n", pong->number); printf("PongPacket num_array[0]: 0x%02x\n", pong->num_array[0]); printf("PongPacket num_array[1]: 0x%02x\n", pong->num_array[1]); + printf("PongPacket nested_array[0][0]: 0x%02x\n", pong->nested_array[0][0]); + printf("PongPacket nested_array[0][1]: 0x%02x\n", pong->nested_array[0][1]); + printf("PongPacket nested_array[1][0]: 0x%02x\n", pong->nested_array[1][0]); + printf("PongPacket nested_array[1][1]: 0x%02x\n", pong->nested_array[1][1]); dragonnet_peer_close(p); dragonnet_peer_delete(p); diff --git a/types.dnet b/types.dnet index f229a76..487e4b8 100644 --- a/types.dnet +++ b/types.dnet @@ -4,3 +4,4 @@ PingPacket PongPacket s32 number u8 num_array[2] + u8 nested_array[2][2] -- 2.44.0