1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/// Registriert einen LOTUS-Script-Typ und exportiert die WASM-Einstiegspunkte.
///
/// Registers a LOTUS script type and exports the WASM entry points.
///
/// Expandiert zu `init`, `register_actions`, `tick` und `late_tick`, die an die [`crate::Script`]-Implementierung
/// des angegebenen Typs delegieren. Eingehende Engine-Nachrichten werden in `late_tick` über [`crate::Script::on_message`] zugestellt.
/// Der Typ muss [`Default`] implementieren.
///
/// Expands to `init`, `register_actions`, `tick`, and `late_tick` functions that
/// delegate to the [`crate::Script`] implementation on the given type. Incoming engine
/// messages are delivered in `late_tick` via [`crate::Script::on_message`].
/// The type must implement [`Default`].
///
/// # Example
///
/// ```no_run
/// # #[cfg(target_arch = "wasm32")]
/// # {
/// use lotus_script::{script, Script};
///
/// #[derive(Default)]
/// struct MyScript;
///
/// impl Script for MyScript {
/// fn tick(&mut self) {
/// // ...
/// }
/// }
///
/// script!(MyScript);
/// # }
/// ```