Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

Marshalls

繼承: Object

資料轉換(marshalling)和編碼輔助工具。

說明

提供進行資料轉換和編碼的實用函式。

方法

PackedByteArray

base64_to_raw(base64_str: String)

String

base64_to_utf8(base64_str: String)

Variant

base64_to_variant(base64_str: String, allow_objects: bool = false)

String

raw_to_base64(array: PackedByteArray)

String

utf8_to_base64(utf8_str: String)

String

variant_to_base64(variant: Variant, full_objects: bool = false)


方法說明

PackedByteArray base64_to_raw(base64_str: String) 🔗

返回對應於 Base64 編碼字串 base64_str 的解碼的 PackedByteArray


String base64_to_utf8(base64_str: String) 🔗

返回與 Base64 編碼的字串 base64_str 相對應的解碼字串。


Variant base64_to_variant(base64_str: String, allow_objects: bool = false) 🔗

返回一個對應於 Base64 編碼的字串 base64_str 的解碼 Variant。如果 allow_objectstrue,則允許對物件進行解碼。

內部實作時,使用的解碼機制與 @GlobalScope.bytes_to_var() 方法相同。

警告:反序列化的物件可能包含會被執行的程式碼。如果序列化的物件來自不受信任的來源,請不要使用這個選項,以避免潛在的安全威脅,如遠端程式碼執行。


String raw_to_base64(array: PackedByteArray) 🔗

返回給定 PackedByteArray 的 Base64 編碼的字串。


String utf8_to_base64(utf8_str: String) 🔗

返回 UTF-8 字串 utf8_str 的 Base64 編碼的字串。


String variant_to_base64(variant: Variant, full_objects: bool = false) 🔗

返回經過 Base64 編碼的 Variant variant 的字串。如果 full_objectstrue,則允許將物件進行編碼(有可能包括代碼)。

內部實作時,使用的編碼機制與 @GlobalScope.var_to_bytes() 方法相同。