@@ -50,6 +50,11 @@ macro_rules! inner_godot_msg {
50
50
51
51
/// Pushes a warning message to Godot's built-in debugger and to the OS terminal.
52
52
///
53
+ /// # See also
54
+ /// [`godot_print!`](macro.godot_print.html) and [`godot_error!`](macro.godot_error.html).
55
+ ///
56
+ /// Related to the utility function [`global::push_warning()`](crate::global::push_warning).
57
+ ///
53
58
/// _Godot equivalent: [`@GlobalScope.push_warning()`](https://docs.godotengine.org/en/stable/classes/class_@globalscope.html#class-globalscope-method-push-warning)_.
54
59
#[ macro_export]
55
60
macro_rules! godot_warn {
@@ -60,6 +65,12 @@ macro_rules! godot_warn {
60
65
61
66
/// Pushes an error message to Godot's built-in debugger and to the OS terminal.
62
67
///
68
+ /// # See also
69
+ /// [`godot_print!`](macro.godot_print.html) and [`godot_warn!`](macro.godot_warn.html).
70
+ /// For script errors (less relevant in Rust), use [`godot_script_error!`](macro.godot_script_error.html).
71
+ ///
72
+ /// Related to the utility function [`global::push_error()`][crate::global::push_error].
73
+ ///
63
74
/// _Godot equivalent: [`@GlobalScope.push_error()`](https://docs.godotengine.org/en/stable/classes/class_@globalscope.html#class-globalscope-method-push-error)_.
64
75
#[ macro_export]
65
76
macro_rules! godot_error {
@@ -69,6 +80,13 @@ macro_rules! godot_error {
69
80
}
70
81
71
82
/// Logs a script error to Godot's built-in debugger and to the OS terminal.
83
+ ///
84
+ /// This is rarely needed in Rust; script errors are typically emitted by the GDScript parser.
85
+ ///
86
+ /// # See also
87
+ /// [`godot_error!`](macro.godot_error.html) for a general error message.
88
+ ///
89
+ ///
72
90
#[ macro_export]
73
91
macro_rules! godot_script_error {
74
92
( $fmt: literal $( , $args: expr) * $( , ) ?) => {
@@ -78,6 +96,22 @@ macro_rules! godot_script_error {
78
96
79
97
/// Prints to the Godot console.
80
98
///
99
+ /// Automatically appends a newline character at the end of the message.
100
+ ///
101
+ /// Used exactly like standard [`println!`]:
102
+ /// ```no_run
103
+ /// use godot::global::godot_print;
104
+ ///
105
+ /// let version = 4;
106
+ /// godot_print!("Hello, Godot {version}!");
107
+ /// ```
108
+ ///
109
+ /// # See also
110
+ /// [`godot_print_rich!`](macro.godot_print_rich.html) for a slower alternative that supports BBCode, color and URL tags.
111
+ /// To print Godot errors and warnings, use [`godot_error!`](macro.godot_error.html) and [`godot_warn!`](macro.godot_warn.html), respectively.
112
+ ///
113
+ /// This uses the underlying [`global::print()`][crate::global::print] function, which takes a variable-length slice of variants.
114
+ ///
81
115
/// _Godot equivalent: [`@GlobalScope.print()`](https://docs.godotengine.org/en/stable/classes/class_@globalscope.html#class-globalscope-method-print)_.
82
116
#[ macro_export]
83
117
macro_rules! godot_print {
@@ -92,7 +126,7 @@ macro_rules! godot_print {
92
126
93
127
/// Prints to the Godot console. Supports BBCode, color and URL tags.
94
128
///
95
- /// Slower than [`godot_print!`].
129
+ /// Slower than [`godot_print!`](macro.godot_print_rich.html) .
96
130
///
97
131
/// _Godot equivalent: [`@GlobalScope.print_rich()`](https://docs.godotengine.org/en/stable/classes/class_@globalscope.html#class-globalscope-method-print-rich)_.
98
132
#[ macro_export]
@@ -106,7 +140,24 @@ macro_rules! godot_print_rich {
106
140
} ;
107
141
}
108
142
109
- /// Concatenates format-style into a `GString`.
143
+ /// Concatenates format-style arguments into a `GString`.
144
+ ///
145
+ /// Works similar to Rust's standard [`format!`] macro but returns a Godot `GString`.
146
+ ///
147
+ /// # Example
148
+ /// ```no_run
149
+ /// use godot::builtin::GString;
150
+ /// use godot::global::godot_str;
151
+ ///
152
+ /// let name = "Player";
153
+ /// let score = 100;
154
+ /// let message: GString = godot_str!("The {name} scored {score} points!");
155
+ /// ```
156
+ ///
157
+ /// # See also
158
+ /// This macro uses the underlying [`global::str()`][crate::global::str] function, which takes a variable-length slice of variants.
159
+ ///
160
+ /// _Godot equivalent: [`@GlobalScope.str()`](https://docs.godotengine.org/en/stable/classes/class_@globalscope.html#class-globalscope-method-str)_.
110
161
#[ macro_export]
111
162
macro_rules! godot_str {
112
163
( $fmt: literal $( , $args: expr) * $( , ) ?) => {
0 commit comments