@@ -19,7 +19,7 @@ event.start {
1919- ** Supports variables, lists, and custom blocks**
2020- ** Event-driven programming** with Scratch hat blocks
2121- ** Type annotations** for better code clarity
22- - ** Decorators** for external block integration
22+ - ** Decorators** for exporting blocks and variables
2323- Can be used as ** Intermediate Representation (IR)** for other languages, or as a component for Scratch Addons
2424
2525## Examples
@@ -113,15 +113,14 @@ event.keyPressed("space") {
113113}
114114```
115115
116- ### Using External Blocks with Decorators
116+ ### Export Blocks with Decorators
117117
118118``` fuse
119- // Define external Scratch blocks using @extern decorator
120- @extern("wait 1 frame") fn yield() once -> void {
121- // External block implementation
119+ // Export Scratch blocks using @export decorator
120+ @export("wait 1 frame") fn yield() once -> void {
122121}
123122
124- @extern ("current timestamp") fn currentTimestamp() once -> any {
123+ @export ("current timestamp") fn currentTimestamp() once -> any {
125124 return sensing.daysSince2000() * 86400 * 1000
126125}
127126
@@ -140,13 +139,21 @@ event.start {
140139### FPS Counter Example
141140
142141``` fuse
143- @extern("last timestamp") let lastTimestamp = 0
142+ @export("// [value]") fn description(value: any) once -> void {
143+ // This function is a no-op, used for adding comments in the generated Scratch blocks
144+ }
145+ @export("drop [value]") fn drop(value: any) once -> void {
146+ description(value)
147+ }
148+ @export("last timestamp") let lastTimestamp = 0
144149
145- @extern ("current timestamp") fn currentTimestamp() once -> any {
150+ @export ("current timestamp") fn currentTimestamp() once -> any {
146151 return sensing.daysSince2000() * 86400 * 1000
147152}
148153
149- @extern("wait 1 frame") fn yield() once -> void {}
154+ @export("wait 1 frame") fn yield() once -> void {
155+ drop(translate.getTranslate(1, ""))
156+ }
150157
151158fn calculateFps() once -> any {
152159 lastTimestamp = currentTimestamp()
0 commit comments