|
16 | 16 | APIs and functionality and can do anything that built-in scripts can do. |
17 | 17 | </p> |
18 | 18 |
|
19 | | -<h3>Delegate Arguments</h3> |
20 | | - |
21 | | -<p> |
22 | | - In addition to Script Methods, <em>#Script</em> also lets you call delegates registered as arguments: |
23 | | -</p> |
24 | | - |
25 | | -{{ 'gfm/script-net/01.md' |> githubMarkdown }} |
26 | | - |
27 | | -<p> |
28 | | - Which just like <a href="/docs/blocks#function">user-defined functions</a> and other Script Methods can be called positionally or as an |
29 | | - <a href="/docs/syntax#extension-methods">extension method</a>: |
30 | | -</p> |
31 | | - |
32 | | -<pre><code>fn(1,2) |
33 | | -1.fn(2)</code></pre> |
34 | | - |
35 | | -<h4 id="shadowing">Shadowing Methods</h4> |
36 | | - |
37 | | -<p> |
38 | | - You can easily override default script methods with the same name and arguments by inserting them at the start of the <em>ScriptMethods</em> list: |
39 | | -</p> |
40 | | - |
41 | | -{{ 'gfm/methods/01.md' |> githubMarkdown }} |
42 | | - |
43 | | -<h4 id="removing">Removing Default Scripts</h4> |
44 | | - |
45 | | -<p> |
46 | | - Or if you want to start from a clean slate, the default scripts can be removed by clearing the collection: |
47 | | -</p> |
48 | | - |
49 | | -{{ 'gfm/methods/02.md' |> githubMarkdown }} |
50 | | - |
51 | 19 | <h4>What are Script Methods?</h4> |
52 | 20 |
|
53 | 21 | <p> |
@@ -108,16 +76,43 @@ <h5>Autowired using ScriptContext IOC</h5> |
108 | 76 | Where it will search each Type in the Assembly for Script Methods and automatically register them. |
109 | 77 | </p> |
110 | 78 |
|
111 | | -<h5>Method Resolution</h5> |
| 79 | +<h3>Method Resolution</h3> |
112 | 80 |
|
113 | 81 | <p> |
114 | 82 | #Script will use the first matching method with the same name and argument count it can find by searching through all |
115 | 83 | registered methods in the <em>ScriptMethods</em> collection, so you could override default methods with the same name by |
116 | 84 | inserting your ScriptMethods as the first item in the collection, e.g: |
117 | 85 | </p> |
118 | 86 |
|
| 87 | +<h5 id="shadowing">Shadowing Methods</h5> |
| 88 | + |
119 | 89 | {{ 'gfm/methods/09.md' |> githubMarkdown }} |
120 | 90 |
|
| 91 | +<h3>Delegate Arguments</h3> |
| 92 | + |
| 93 | +<p> |
| 94 | + In addition to Script Methods, <em>#Script</em> also lets you call delegates registered as arguments: |
| 95 | +</p> |
| 96 | + |
| 97 | +{{ 'gfm/script-net/01.md' |> githubMarkdown }} |
| 98 | + |
| 99 | +<p> |
| 100 | + Which just like <a href="/docs/blocks#function">user-defined functions</a> and other Script Methods can be called positionally or as an |
| 101 | + <a href="/docs/syntax#extension-methods">extension method</a>: |
| 102 | +</p> |
| 103 | + |
| 104 | +<pre><code>fn(1,2) |
| 105 | +1.fn(2)</code></pre> |
| 106 | + |
| 107 | +<h4 id="removing">Removing Default Scripts</h4> |
| 108 | + |
| 109 | +<p> |
| 110 | + Or if you want to start from a clean slate, the default scripts can be removed by clearing the collection: |
| 111 | +</p> |
| 112 | + |
| 113 | +{{ 'gfm/methods/02.md' |> githubMarkdown }} |
| 114 | + |
| 115 | + |
121 | 116 | <h4>Auto coercion into Method argument Types</h4> |
122 | 117 |
|
123 | 118 | <p> |
|
0 commit comments