mirror of
https://github.com/Relintai/pandemonium_demo_projects.git
synced 2024-12-21 13:56:50 +01:00
18 lines
316 B
GDScript
18 lines
316 B
GDScript
extends Node
|
|
|
|
func encode_data(data, mode):
|
|
if mode == WebSocketPeer.WRITE_MODE_TEXT:
|
|
return data.to_utf8()
|
|
return var2bytes(data)
|
|
|
|
|
|
func decode_data(data, is_string):
|
|
if is_string:
|
|
return data.get_string_from_utf8()
|
|
return bytes2var(data)
|
|
|
|
|
|
func _log(node, msg):
|
|
print(msg)
|
|
node.add_text(str(msg) + "\n")
|