Skip to content

Commit e8b9e1c

Browse files
committed
add docs
0 parents  commit e8b9e1c

File tree

264 files changed

+57311
-0
lines changed

Some content is hidden

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

264 files changed

+57311
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
site/
2+
*.tmp*
3+
*.pyc

docs/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
usage.md.backup

docs/api.md

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#![](images/luxe-dark.svg){width="96em"}
2+
3+
# `luxe` API (`2021.0.3`)
4+
5+
6+
---
7+
8+
- [luxe: assert](assert)
9+
- [luxe: assets](assets)
10+
- [luxe: astar](astar)
11+
- [luxe: audio](audio)
12+
- [luxe: bytes](bytes)
13+
- [luxe: color](color)
14+
- [luxe: containers](containers)
15+
- [luxe: draw](draw)
16+
- [luxe: editor](editor)
17+
- [luxe: events](events)
18+
- [luxe: game](game)
19+
- [luxe: id](id)
20+
- [luxe: input](input)
21+
- [luxe: io](io)
22+
- [luxe: lx](lx)
23+
- [luxe: mat4](mat4)
24+
- [luxe: math](math)
25+
- [luxe: pqueue](pqueue)
26+
- [luxe: regex](regex)
27+
- [luxe: render](render)
28+
- [luxe: result](result)
29+
- [luxe: sat2D](sat2D)
30+
- [luxe: semver](semver)
31+
- [luxe: settings](settings)
32+
- [luxe: shape2D](shape2D)
33+
- [luxe: string](string)
34+
- [luxe: terminal](terminal)
35+
- [luxe: test](test)
36+
- [luxe: ui](ui)
37+
- [luxe: ui/button](ui/button)
38+
- [luxe: ui/check](ui/check)
39+
- [luxe: ui/control](ui/control)
40+
- [luxe: ui/image](ui/image)
41+
- [luxe: ui/label](ui/label)
42+
- [luxe: ui/list](ui/list)
43+
- [luxe: ui/panel](ui/panel)
44+
- [luxe: ui/progress](ui/progress)
45+
- [luxe: ui/scroll](ui/scroll)
46+
- [luxe: ui/slider](ui/slider)
47+
- [luxe: ui/text](ui/text)
48+
- [luxe: ui/window](ui/window)
49+
- [luxe: version](version)
50+
- [luxe: world](world)
51+
52+

docs/api/assert.md

+114
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
#![](../images/luxe-dark.svg){width="96em"}
2+
3+
# `luxe` API (`2021.0.3`)
4+
5+
6+
---
7+
8+
## `luxe: assert` module
9+
10+
- [Assert](#assert)
11+
12+
---
13+
14+
### Assert
15+
`:::js import "luxe: assert" for Assert`
16+
> Simple assertions.
17+
18+
An assertion is a statement in code that is a strict rule.
19+
They prevent code from behaving in unexpected ways, by asserting that the code is acting in the way you intended.
20+
This can catch a lot of bugs, because it can enforce correct usage of code.
21+
22+
For example, if your function does not allow null for an argument, that is something you can assert.
23+
Then the user of your code knows that they've used your API incorrectly and can correct the issue.
24+
25+
An assertion calls `Fiber.abort()`, ending execution (unless handled higher up).
26+
27+
- [is_true](#Assert.is_true)(**condition**: `Any`)
28+
- [is_true](#Assert.is_true+2)(**condition**: `Any`, **message**: `Any`)
29+
- [is_false](#Assert.is_false)(**condition**: `Any`)
30+
- [is_false](#Assert.is_false+2)(**condition**: `Any`, **message**: `Any`)
31+
- [not_null](#Assert.not_null)(**value**: `Any`)
32+
- [not_null](#Assert.not_null+2)(**value**: `Any`, **message**: `Any`)
33+
- [is_null](#Assert.is_null)(**value**: `Any`)
34+
- [is_null](#Assert.is_null+2)(**value**: `Any`, **message**: `Any`)
35+
36+
<hr/>
37+
<endpoint module="luxe: assert" class="Assert" signature="is_true(condition : Any)"></endpoint>
38+
<signature id="Assert.is_true">Assert.is_true(**condition**: `Any`)
39+
<a class="headerlink" href="#Assert.is_true" title="Permanent link">¶</a></signature>
40+
<span class='api_ret'>returns</span> `:::js None`
41+
> Assert that a particular condition is true.
42+
```js
43+
//In this code, we expect that the player
44+
//should never be here if they are not flying.
45+
Assert.is_true(player.flying)
46+
```
47+
48+
<endpoint module="luxe: assert" class="Assert" signature="is_true(condition : Any, message : Any)"></endpoint>
49+
<signature id="Assert.is_true+2">Assert.is_true(**condition**: `Any`, **message**: `Any`)
50+
<a class="headerlink" href="#Assert.is_true+2" title="Permanent link">¶</a></signature>
51+
<span class='api_ret'>returns</span> `:::js None`
52+
> Assert that a particular condition is true, and display a message on abort.
53+
```js
54+
//In this code, we expect that the player
55+
//should never be here if they are not flying.
56+
Assert.is_true(player.flying, "Expected player to be in a flying state")
57+
```
58+
59+
<endpoint module="luxe: assert" class="Assert" signature="is_false(condition : Any)"></endpoint>
60+
<signature id="Assert.is_false">Assert.is_false(**condition**: `Any`)
61+
<a class="headerlink" href="#Assert.is_false" title="Permanent link">¶</a></signature>
62+
<span class='api_ret'>returns</span> `:::js None`
63+
> Assert that a particular condition is false.
64+
```js
65+
Assert.is_false(player.flying)
66+
```
67+
68+
<endpoint module="luxe: assert" class="Assert" signature="is_false(condition : Any, message : Any)"></endpoint>
69+
<signature id="Assert.is_false+2">Assert.is_false(**condition**: `Any`, **message**: `Any`)
70+
<a class="headerlink" href="#Assert.is_false+2" title="Permanent link">¶</a></signature>
71+
<span class='api_ret'>returns</span> `:::js None`
72+
> Assert that a particular condition is false, and display a message on abort.
73+
```js
74+
Assert.is_false(player.flying, "Expected player NOT to be in a flying state")
75+
```
76+
77+
<endpoint module="luxe: assert" class="Assert" signature="not_null(value : Any)"></endpoint>
78+
<signature id="Assert.not_null">Assert.not_null(**value**: `Any`)
79+
<a class="headerlink" href="#Assert.not_null" title="Permanent link">¶</a></signature>
80+
<span class='api_ret'>returns</span> `:::js None`
81+
> Assert that a particular statement is not null.
82+
```js
83+
//We require a valid player in this code
84+
Assert.not_null(player)
85+
```
86+
87+
<endpoint module="luxe: assert" class="Assert" signature="not_null(value : Any, message : Any)"></endpoint>
88+
<signature id="Assert.not_null+2">Assert.not_null(**value**: `Any`, **message**: `Any`)
89+
<a class="headerlink" href="#Assert.not_null+2" title="Permanent link">¶</a></signature>
90+
<span class='api_ret'>returns</span> `:::js None`
91+
> Assert that a particular statement is not null, and display a message on abort.
92+
```js
93+
Assert.not_null(player, "A valid player is required")
94+
```
95+
96+
<endpoint module="luxe: assert" class="Assert" signature="is_null(value : Any)"></endpoint>
97+
<signature id="Assert.is_null">Assert.is_null(**value**: `Any`)
98+
<a class="headerlink" href="#Assert.is_null" title="Permanent link">¶</a></signature>
99+
<span class='api_ret'>returns</span> `:::js None`
100+
> Assert that a particular statement is null.
101+
```js
102+
//We assume the player is not holding something.
103+
Assert.is_null(player.item_in_hand)
104+
```
105+
106+
<endpoint module="luxe: assert" class="Assert" signature="is_null(value : Any, message : Any)"></endpoint>
107+
<signature id="Assert.is_null+2">Assert.is_null(**value**: `Any`, **message**: `Any`)
108+
<a class="headerlink" href="#Assert.is_null+2" title="Permanent link">¶</a></signature>
109+
<span class='api_ret'>returns</span> `:::js None`
110+
> Assert that a particular statement is null, and display a message on abort.
111+
```js
112+
Assert.is_null(player.item_in_hand, "Player must not have an item in hand when calling this")
113+
```
114+

0 commit comments

Comments
 (0)