2
0
Эх сурвалжийг харах

Fixed 'Reporting node configuration warnings' code snippet

- Switched .size for .length
- initialized warnings as empty array
- warning.append instead of +=
- deleted new line
Daniel Delgado 2 жил өмнө
parent
commit
db45a5378b

+ 5 - 8
tutorials/plugins/running_code_in_the_editor.rst

@@ -267,15 +267,12 @@ By default, the warning only updates when closing and reopening the scene.
                 update_configuration_warnings()
 
 
-    func _get_configuration_warning():
-        var warning = ""
+    func _get_configuration_warnings():
+        var warning = []
         if title == "":
-            warning += "Please set `title` to a non-empty value."
-        if description.size() >= 100:
-            # Add a blank line between each warning to distinguish them individually.
-            if warning != "":
-                warning += "\n"
-            warning += "`description` should be less than 100 characters long."
+            warning.append("Please set `title` to a non-empty value.")
+        if description.length() >= 100:
+            warning.append("`description` should be less than 100 characters long.")
 
         # Returning an empty string means "no warning".
         return warning