diff --git a/docs/docs/reference/modules/misc.md b/docs/docs/reference/modules/misc.md index 6e44424..c059222 100644 --- a/docs/docs/reference/modules/misc.md +++ b/docs/docs/reference/modules/misc.md @@ -68,3 +68,17 @@ var misc: CoreBaseModule = core.misc func _ready() -> void: position = misc.center_object(get_parent().size, size) ``` +### *String* stringify_variables(*String* template, *Dictionary* variables, *bool* no_quotes = *false*, *bool* force_no_type = *false*) +Makes variables as look correct inside strings. \ +Short examples: \ +`true` -> `'true'` \ +`Vector2(69.064, PI)` -> `'x=69.064 y=3.14159265358979'` \ +`"This is a test string"` -> `'"This is a test string"'` \ +Full example: \ +``` +Code: +logger.diag(stringify_variables("Triggered %trigger% (pos=%position%, successful=%success%)", { "trigger": "shoot", "position": Vector2(5156.149, 581.69), "success": true })) + +Output: +[16:44:35] [DIAG Test.gd] Triggered '"shoot"' (pos='x=5156.149 y=581.69', successful='true') +```