Skip to content

Commit 1a4daa1

Browse files
committed
Update to 1.23.0
1 parent 312e8c8 commit 1a4daa1

41 files changed

Lines changed: 773 additions & 111 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

appendix/operators.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,10 @@ <h2 id="symbols-and-patterns"><a class="header" href="#symbols-and-patterns">Sym
246246
<tr><td style="text-align: center"><code>!</code></td><td>bang</td><td>function call in calling scope</td></tr>
247247
<tr><td style="text-align: center"><code>=&gt;</code></td><td>double arrow</td><td><code>switch</code> expression case separator</td></tr>
248248
<tr><td style="text-align: center"><code>//</code></td><td>comment</td><td>line comment</td></tr>
249-
<tr><td style="text-align: center"><code>///</code></td><td>doc-comment</td><td>line [doc-comment]</td></tr>
249+
<tr><td style="text-align: center"><code>///</code></td><td>doc-comment</td><td>line <a href="/book/language/doc-comments.html">doc-comment</a></td></tr>
250250
<tr><td style="text-align: center"><code>//!</code></td><td>module doc</td><td><a href="/book/language/comments.html">module documentation</a></td></tr>
251251
<tr><td style="text-align: center"><code>/*</code><code>*/</code></td><td>comment</td><td>block comment</td></tr>
252-
<tr><td style="text-align: center"><code>/**</code><code>*/</code></td><td>doc-comment</td><td>block [doc-comment]</td></tr>
252+
<tr><td style="text-align: center"><code>/**</code><code>*/</code></td><td>doc-comment</td><td>block <a href="/book/language/doc-comments.html">doc-comment</a></td></tr>
253253
<tr><td style="text-align: center"><code>(*</code><code>*)</code></td><td>comment</td><td><em>reserved</em></td></tr>
254254
<tr><td style="text-align: center"><code>#!</code></td><td>shebang</td><td><em>reserved</em></td></tr>
255255
<tr><td style="text-align: center"><code>++</code></td><td>increment</td><td><em>reserved</em></td></tr>

context.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = "1.22.0"
1+
version = "1.23.0"
22
repoHome = "https://github.com/rhaiscript/rhai/blob/main"
33
#rootUrl = ""
44
rootUrl = "/book"

engine/ast.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ <h1 id="manage-asts"><a class="header" href="#manage-asts">Manage <code>AST</cod
226226
<a class="admonition-anchor-link" href="#admonition-ast-public-api"></a>
227227
</div>
228228
<div>
229-
<p>For the complete <a href="/book/engine/compile.html"><code>AST</code></a> API, refer to the <a href="https://docs.rs/rhai/1.22.0/rhai/struct.AST.html">documentation</a> online.</p>
229+
<p>For the complete <a href="/book/engine/compile.html"><code>AST</code></a> API, refer to the <a href="https://docs.rs/rhai/1.23.0/rhai/struct.AST.html">documentation</a> online.</p>
230230
</div>
231231
</div>
232232
<h2 id="extract-only-functions"><a class="header" href="#extract-only-functions">Extract Only Functions</a></h2>

engine/call-fn.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ <h2 id="enginecall_fn_with_options"><a class="header" href="#enginecall_fn_with_
364364
<tr><td><code>eval_ast</code></td><td style="text-align: center"><code>bool</code></td><td style="text-align: center"><code>true</code></td><td style="text-align: center"><code>eval_ast</code></td><td>evaluate the <a href="/book/engine/compile.html"><code>AST</code></a> before calling the target <a href="/book/language/functions.html">function</a> (useful to run <a href="/book/language/modules/import.html"><code>import</code></a> statements)</td></tr>
365365
<tr><td><code>rewind_scope</code></td><td style="text-align: center"><code>bool</code></td><td style="text-align: center"><code>true</code></td><td style="text-align: center"><code>rewind_scope</code></td><td>rewind the custom <a href="/book/engine/scope.html"><code>Scope</code></a> at the end of the <a href="/book/language/functions.html">function</a> call so new local variables are removed</td></tr>
366366
<tr><td><code>this_ptr</code></td><td style="text-align: center"><a href="/book/language/dynamic.html"><code>Option&lt;&amp;mut Dynamic&gt;</code></a></td><td style="text-align: center"><code>None</code></td><td style="text-align: center"><code>bind_this_ptr</code></td><td>bind the <code>this</code> pointer to a specific value</td></tr>
367+
<tr><td><code>in_all_namespaces</code></td><td style="text-align: center"><code>bool</code></td><td style="text-align: center"><code>false</code></td><td style="text-align: center"><code>in_all_namespaces</code></td><td>call function in all namespaces, not only scripted function within the <a href="/book/engine/compile.html"><code>AST</code></a></td></tr>
367368
<tr><td><code>tag</code></td><td style="text-align: center"><a href="/book/language/dynamic.html"><code>Option&lt;Dynamic&gt;</code></a></td><td style="text-align: center"><code>None</code></td><td style="text-align: center"><code>with_tag</code></td><td>set the <em>custom state</em> for this evaluation (accessed via <a href="/book/rust/context.html"><code>NativeCallContext::tag</code></a>)</td></tr>
368369
</tbody></table>
369370
</div>
@@ -454,6 +455,18 @@ <h3 id="bind-the-this-pointer"><a class="header" href="#bind-the-this-pointer">B
454455
engine.call_fn_with_options(options, &amp;mut scope, &amp;ast, "action", ( 41_i64, ))?;
455456

456457
assert_eq!(value.as_int()?, 42);</code></pre>
458+
<h3 id="just-call-any-function"><a class="header" href="#just-call-any-function">Just call any function</a></h3>
459+
<p>Sometimes it is useful to just make a function call without worrying whether the function is a
460+
Rhai-scripted <a href="/book/language/functions.html">function</a> in the <a href="/book/engine/compile.html"><code>AST</code></a>.</p>
461+
<p>Setting <code>in_all_namespaces</code> to <code>true</code> allows this.</p>
462+
<pre><code class="language-rust">
463+
let options = CallFnOptions::new().in_all_namespaces(true);
464+
465+
engine.call_fn_with_options(options, &amp;mut scope, &amp;ast, "calc", (1, 2, 3))?;
466+
467+
// The function 'calc' will be called with three arguments (1,2, 3) regardless of
468+
// whether it is a scripted Rhai function, a native Rust function or a module function
469+
// loaded into the 'Engine'.</code></pre>
457470

458471
</main>
459472

0 commit comments

Comments
 (0)