Can i send array or dictionary using PacketPeerUDP?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By atopetrick

I’m creating demo game for two player using PacketPeerUDP . i create server/client script and when i send String, it will sending/receiving messages to each other without any error.

Now When i tried to send [1,2,3] or ["p1:":"123"], i’m facing error Invalid call. Nonexistent function 'to_ascii' in base 'Array'.

Does there is anyway to send array using PacketPeerUDP?

:bust_in_silhouette: Reply From: wombatstampede

You can use to_json to convert the array into a string, send that and use parse_json on the receiving side to convert the string back to the array again.

@wombatstampede thanks :slight_smile:

atopetrick | 2019-04-03 13:01