mirror of
https://codeberg.org/vlw/mcfstd.git
synced 2026-04-12 22:29:39 +02:00
docs: fix mistakes in the README (#2)
This PR fixes some mistakes in the README. It also removes the "example" colum from the function reference since I believe the description for each function should suffice and make the table more readable. Reviewed-on: https://codeberg.org/vlw/mcfstd/pulls/2 Co-authored-by: vlw <victor@vlw.se> Co-committed-by: vlw <victor@vlw.se>
This commit is contained in:
parent
c4195baf85
commit
0385912729
1 changed files with 19 additions and 34 deletions
53
README.md
53
README.md
|
|
@ -66,12 +66,14 @@ execute if std:out run return run function my_function
|
|||
```
|
||||
|
||||
# Functions
|
||||
> [!Note]
|
||||
> The functions under the `z_:` namespace are used internally by mcfstd and are not meant to be called directly unless you know what you are doing.
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Function</th>
|
||||
<th>Arguments</th>
|
||||
<th>Description</th>
|
||||
<th>Example</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="4">Variables</th>
|
||||
|
|
@ -81,7 +83,6 @@ execute if std:out run return run function my_function
|
|||
<td rowspan="2"><code>var:set</code></td>
|
||||
<td><code>k</code> Name of the variable (string)</td>
|
||||
<td rowspan="2">Set the value of a variable</td>
|
||||
<td rowspan="2"><code>function var:set { k: my_variable, v: 10 }</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>v</code> Value of the variable (int)</td>
|
||||
|
|
@ -91,14 +92,12 @@ execute if std:out run return run function my_function
|
|||
<td><code>var:unset</code></td>
|
||||
<td><code>k</code> Name of the variable (string)</td>
|
||||
<td>Remove a varialbe</td>
|
||||
<td><code>function var:unset { k: my_variable }</code></td>
|
||||
</tr>
|
||||
<!-- var:mv -->
|
||||
<tr>
|
||||
<td rowspan="2"><code>var:mv</code></td>
|
||||
<td><code>k</code> Old variable name (string)</td>
|
||||
<td rowspan="2">Rename a variable</td>
|
||||
<td rowspan="2"><code>function var:mv { k: my_variable, v: my_renamed_variable }</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>v</code> New variable name (string)</td>
|
||||
|
|
@ -108,21 +107,18 @@ execute if std:out run return run function my_function
|
|||
<td><code>var:inc</code></td>
|
||||
<td><code>k</code> Name of the variable (string)</td>
|
||||
<td>Increment the value of a variable</td>
|
||||
<td><code>function var:inc { k: my_variable }</code></td>
|
||||
</tr>
|
||||
<!-- var:dec -->
|
||||
<tr>
|
||||
<td><code>var:dec</code></td>
|
||||
<td><code>k</code> Name of the variable (string)</td>
|
||||
<td>Decrement the value of a variable</td>
|
||||
<td><code>function var:dec { k: my_variable }</code></td>
|
||||
</tr>
|
||||
<!-- var:put -->
|
||||
<tr>
|
||||
<td><code>var:put</code></td>
|
||||
<td>-</td>
|
||||
<td>Put the current value of A into this variable</td>
|
||||
<td><code>function var:put { k: my_variable }</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="4">Arithmetic</th>
|
||||
|
|
@ -132,50 +128,45 @@ execute if std:out run return run function my_function
|
|||
<td rowspan="2"><code>math:add</code></td>
|
||||
<td><code>k</code> Name of the variable (string)</td>
|
||||
<td rowspan="2">Add a number to the current value of a variable and store the result in A</td>
|
||||
<td rowspan="2"><code>function math:add { k: my_variable, v: 10 }</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>v</code> Number to add (string)</td>
|
||||
<td><code>v</code> Number to add (int)</td>
|
||||
</tr>
|
||||
<!-- math:sub -->
|
||||
<tr>
|
||||
<td rowspan="2"><code>math:sub</code></td>
|
||||
<td><code>k</code> Name of the variable (string)</td>
|
||||
<td rowspan="2">Subtract a number to the current value of a variable and store the result in A</td>
|
||||
<td rowspan="2"><code>function math:sub { k: my_variable, v: 10 }</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>v</code> Number to subtract (string)</td>
|
||||
<td><code>v</code> Number to subtract (int)</td>
|
||||
</tr>
|
||||
<!-- math:mul -->
|
||||
<tr>
|
||||
<td rowspan="2"><code>math:mul</code></td>
|
||||
<td><code>k</code> Name of the variable (string)</td>
|
||||
<td rowspan="2">Multiply a number with the current value of a variable and store the result in A</td>
|
||||
<td rowspan="2"><code>function math:mul { k: my_variable, v: 10 }</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>v</code> Number to multiply (string)</td>
|
||||
<td><code>v</code> Number to multiply (int)</td>
|
||||
</tr>
|
||||
<!-- math:div -->
|
||||
<tr>
|
||||
<td rowspan="2"><code>math:div</code></td>
|
||||
<td><code>k</code> Name of the variable (string)</td>
|
||||
<td rowspan="2">Divide a number with the current value of a variable and store the result in A</td>
|
||||
<td rowspan="2"><code>function math:div { k: my_variable, v: 10 }</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>v</code> Number to divide (string)</td>
|
||||
<td><code>v</code> Number to divide (int)</td>
|
||||
</tr>
|
||||
<!-- math:mod -->
|
||||
<tr>
|
||||
<td rowspan="2"><code>math:mod</code></td>
|
||||
<td><code>k</code> Name of the variable (string)</td>
|
||||
<td rowspan="2">Modulo a number with the current value of a variable and store the result in A</td>
|
||||
<td rowspan="2"><code>function math:mod { k: my_variable, v: 10 }</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>v</code> Number to modulo (string)</td>
|
||||
<td><code>v</code> Number to modulo (int)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="4">Relation / Compare</th>
|
||||
|
|
@ -184,51 +175,46 @@ execute if std:out run return run function my_function
|
|||
<tr>
|
||||
<td rowspan="2"><code>comp:eq</code></td>
|
||||
<td><code>a</code> Name of the first variable (string)</td>
|
||||
<td rowspan="2">Check if <code>a = b</code> and store the result in <code>stdout</code></td>
|
||||
<td rowspan="2"><code>function comp:eq { a: my_variable, b: my_other_variable }</code></td>
|
||||
<td rowspan="2">Check if <code>a = b</code> and store the result in <a href="#the-standard-output">the standard output</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>v</code> Name of the second variable (string)</td>
|
||||
<td><code>b</code> Name of the second variable (string)</td>
|
||||
</tr>
|
||||
<!-- comp:gt -->
|
||||
<tr>
|
||||
<td rowspan="2"><code>comp:gt</code></td>
|
||||
<td><code>a</code> Name of the first variable (string)</td>
|
||||
<td rowspan="2">Check if <code>a > b</code> and store the result in <code>stdout</code></td>
|
||||
<td rowspan="2"><code>function comp:gt { a: my_variable, b: my_other_variable }</code></td>
|
||||
<td rowspan="2">Check if <code>a > b</code> and store the result in <a href="#the-standard-output">the standard output</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>v</code> Name of the second variable (string)</td>
|
||||
<td><code>b</code> Name of the second variable (string)</td>
|
||||
</tr>
|
||||
<!-- comp:gteq -->
|
||||
<tr>
|
||||
<td rowspan="2"><code>comp:gteq</code></td>
|
||||
<td><code>a</code> Name of the first variable (string)</td>
|
||||
<td rowspan="2">Check if <code>a >= b</code> and store the result in <code>stdout</code></td>
|
||||
<td rowspan="2"><code>function comp:gteq { a: my_variable, b: my_other_variable }</code></td>
|
||||
<td rowspan="2">Check if <code>a >= b</code> and store the result in <a href="#the-standard-output">the standard output</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>v</code> Name of the second variable (string)</td>
|
||||
<td><code>b</code> Name of the second variable (string)</td>
|
||||
</tr>
|
||||
<!-- comp:lt -->
|
||||
<tr>
|
||||
<td rowspan="2"><code>comp:lt</code></td>
|
||||
<td><code>a</code> Name of the first variable (string)</td>
|
||||
<td rowspan="2">Check if <code>a < b</code> and store the result in <code>stdout</code></td>
|
||||
<td rowspan="2"><code>function comp:lt { a: my_variable, b: my_other_variable }</code></td>
|
||||
<td rowspan="2">Check if <code>a < b</code> and store the result in <a href="#the-standard-output">the standard output</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>v</code> Name of the second variable (string)</td>
|
||||
<td><code>b</code> Name of the second variable (string)</td>
|
||||
</tr>
|
||||
<!-- comp:lteq -->
|
||||
<tr>
|
||||
<td rowspan="2"><code>comp:lteq</code></td>
|
||||
<td><code>a</code> Name of the first variable (string)</td>
|
||||
<td rowspan="2">Check if <code>a <= b</code> and store the resulteq in <code>stdout</code></td>
|
||||
<td rowspan="2"><code>function comp:lteq { a: my_variable, b: my_other_variable }</code></td>
|
||||
<td rowspan="2">Check if <code>a <= b</code> and store the resulteq in <a href="#the-standard-output">the standard output</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>v</code> Name of the second variable (string)</td>
|
||||
<td><code>b</code> Name of the second variable (string)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="4">Built-in operations</th>
|
||||
|
|
@ -237,7 +223,6 @@ execute if std:out run return run function my_function
|
|||
<tr>
|
||||
<td><code>std:out</code></td>
|
||||
<td>-</td>
|
||||
<td>Will return true if the value of stdout is 0 (success)</td>
|
||||
<td><code>execute if function std:out run function my_function</code></td>
|
||||
<td>Will return nothing if the value of <a href="#the-standard-output">the standard output</a> is not <code>fail</code>. Else this function will also <code>fail</code></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue