aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2025-01-06 17:31:36 +0800
committerLi Jin <dragon-fly@qq.com>2025-01-06 17:31:36 +0800
commitba511abf3c5eed23f4aef0fde0a3e6e0e8f3f41f (patch)
treefa60531f63080c647431e6d5e0351b2bac36f024 /doc
parente17183887d53f3ef8a39d14bcb6e55add8ca105b (diff)
downloadyuescript-ba511abf3c5eed23f4aef0fde0a3e6e0e8f3f41f.tar.gz
yuescript-ba511abf3c5eed23f4aef0fde0a3e6e0e8f3f41f.tar.bz2
yuescript-ba511abf3c5eed23f4aef0fde0a3e6e0e8f3f41f.zip
Updated docs.
Diffstat (limited to 'doc')
-rwxr-xr-xdoc/README.md4
-rwxr-xr-xdoc/docs/.vuepress/components/YueCompiler.vue2
-rwxr-xr-xdoc/docs/.vuepress/config.js6
-rw-r--r--doc/docs/.vuepress/public/image/yuescript.svg2
-rwxr-xr-xdoc/docs/doc/README.md88
-rwxr-xr-xdoc/docs/try/README.md4
-rwxr-xr-xdoc/docs/zh/doc/README.md44
-rwxr-xr-xdoc/docs/zh/try/README.md2
8 files changed, 76 insertions, 76 deletions
diff --git a/doc/README.md b/doc/README.md
index 8300661..ec959d4 100755
--- a/doc/README.md
+++ b/doc/README.md
@@ -1,6 +1,6 @@
1# Yuescript 1# YueScript
2 2
3> Yuescript Documentation 3> YueScript Documentation
4 4
5## Development 5## Development
6 6
diff --git a/doc/docs/.vuepress/components/YueCompiler.vue b/doc/docs/.vuepress/components/YueCompiler.vue
index 86d7566..6b6042c 100755
--- a/doc/docs/.vuepress/components/YueCompiler.vue
+++ b/doc/docs/.vuepress/components/YueCompiler.vue
@@ -2,7 +2,7 @@
2 <div style="width: 100%; height: auto;"> 2 <div style="width: 100%; height: auto;">
3 <div class="parent" style="background-color: #f5f7ff;"> 3 <div class="parent" style="background-color: #f5f7ff;">
4 <div class="childL" style="height: 2.5em;"> 4 <div class="childL" style="height: 2.5em;">
5 <div class="childTitle">Yuescript {{ info }}</div> 5 <div class="childTitle">YueScript {{ info }}</div>
6 </div> 6 </div>
7 <div class="childR" style="height: 2.5em;"> 7 <div class="childR" style="height: 2.5em;">
8 <div class="childTitle">Lua</div> 8 <div class="childTitle">Lua</div>
diff --git a/doc/docs/.vuepress/config.js b/doc/docs/.vuepress/config.js
index 70ea66a..1fe44ce 100755
--- a/doc/docs/.vuepress/config.js
+++ b/doc/docs/.vuepress/config.js
@@ -4,7 +4,7 @@ module.exports = {
4 /** 4 /**
5 * Ref:https://v1.vuepress.vuejs.org/config/#title 5 * Ref:https://v1.vuepress.vuejs.org/config/#title
6 */ 6 */
7 title: 'Yuescript', 7 title: 'YueScript',
8 /** 8 /**
9 * Ref:https://v1.vuepress.vuejs.org/config/#description 9 * Ref:https://v1.vuepress.vuejs.org/config/#description
10 */ 10 */
@@ -19,7 +19,7 @@ module.exports = {
19 ['meta', { name: 'theme-color', content: '#3eaf7c' }], 19 ['meta', { name: 'theme-color', content: '#3eaf7c' }],
20 ['meta', { name: 'apple-mobile-web-app-capable', content: 'yes' }], 20 ['meta', { name: 'apple-mobile-web-app-capable', content: 'yes' }],
21 ['meta', { name: 'apple-mobile-web-app-status-bar-style', content: 'black' }], 21 ['meta', { name: 'apple-mobile-web-app-status-bar-style', content: 'black' }],
22 ['meta', { property: 'og:title', content: 'Yuescript' }], 22 ['meta', { property: 'og:title', content: 'YueScript' }],
23 ['meta', { property: 'og:description', content: description }], 23 ['meta', { property: 'og:description', content: description }],
24 // Should probably have a og:url but I'm not sure how to add that without it being the same on all pages 24 // Should probably have a og:url but I'm not sure how to add that without it being the same on all pages
25 ['meta', { property: 'og:type', content: 'website' }], 25 ['meta', { property: 'og:type', content: 'website' }],
@@ -49,7 +49,7 @@ module.exports = {
49 locales: { 49 locales: {
50 '/': { 50 '/': {
51 lang: 'en-US', 51 lang: 'en-US',
52 title: 'Yuescript', 52 title: 'YueScript',
53 description: 'A language that compiles to Lua' 53 description: 'A language that compiles to Lua'
54 }, 54 },
55 55
diff --git a/doc/docs/.vuepress/public/image/yuescript.svg b/doc/docs/.vuepress/public/image/yuescript.svg
index b7e5884..87fdb45 100644
--- a/doc/docs/.vuepress/public/image/yuescript.svg
+++ b/doc/docs/.vuepress/public/image/yuescript.svg
@@ -11,7 +11,7 @@
11 <!ENTITY ns_adobe_xpath "http://ns.adobe.com/XPath/1.0/"> 11 <!ENTITY ns_adobe_xpath "http://ns.adobe.com/XPath/1.0/">
12]> 12]>
13<svg version="1.1" id="图层_1" xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;" 13<svg version="1.1" id="图层_1" xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;"
14 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="" viewBox="250 200 95.3 441.9" xml:space="preserve"> 14 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="" viewBox="105 200 400 441.9" xml:space="preserve">
15 <g> 15 <g>
16 <g> 16 <g>
17 <path fill="#B4AC8F" d="M209.8,522.5c-3.7,0.8-8.1,1.6-11.7,2.3c0.5-2,1.9-7.8,2.9-11.5l-2.8-2.9l-3.3,14.5c0,0.2-0.1,0.4-0.3,0.6 17 <path fill="#B4AC8F" d="M209.8,522.5c-3.7,0.8-8.1,1.6-11.7,2.3c0.5-2,1.9-7.8,2.9-11.5l-2.8-2.9l-3.3,14.5c0,0.2-0.1,0.4-0.3,0.6
diff --git a/doc/docs/doc/README.md b/doc/docs/doc/README.md
index 2835ffb..814593b 100755
--- a/doc/docs/doc/README.md
+++ b/doc/docs/doc/README.md
@@ -3,17 +3,17 @@ sidebar: auto
3title: Reference 3title: Reference
4--- 4---
5 5
6# Yuescript 6# YueScript
7 7
8<img src="/image/yuescript.svg" width="300px" height="300px" alt="logo"/> 8<img src="/image/yuescript.svg" width="300px" height="300px" alt="logo"/>
9 9
10## Introduction 10## Introduction
11 11
12Yuescript is a dynamic language that compiles to Lua. And it's a [Moonscript](https://github.com/leafo/moonscript) dialect. The codes written in Yuescript are expressive and extremely concise. And it is suitable for writing some changing application logic with more maintainable codes and runs in a Lua embeded environment such as games or website servers. 12YueScript is a dynamic language that compiles to Lua. And it's a [MoonScript](https://github.com/leafo/moonscript) dialect. The codes written in YueScript are expressive and extremely concise. And it is suitable for writing some changing application logic with more maintainable codes and runs in a Lua embeded environment such as games or website servers.
13 13
14Yue (月) is the name of moon in Chinese and it's pronounced as [jyɛ]. 14Yue (月) is the name of moon in Chinese and it's pronounced as [jyɛ].
15 15
16### An Overview of Yuescript 16### An Overview of YueScript
17```moonscript 17```moonscript
18-- import syntax 18-- import syntax
19import "yue" as :p, :to_lua 19import "yue" as :p, :to_lua
@@ -104,12 +104,12 @@ export 🌛 = "月之脚本"
104> make install 104> make install
105``` 105```
106 106
107&emsp;Build Yuescript tool without macro feature: 107&emsp;Build YueScript tool without macro feature:
108``` 108```
109> make install NO_MACRO=true 109> make install NO_MACRO=true
110``` 110```
111 111
112&emsp;Build Yuescript tool without built-in Lua binary: 112&emsp;Build YueScript tool without built-in Lua binary:
113``` 113```
114> make install NO_LUA=true 114> make install NO_LUA=true
115``` 115```
@@ -118,17 +118,17 @@ export 🌛 = "月之脚本"
118 118
119### Lua Module 119### Lua Module
120 120
121&emsp;Use Yuescript module in Lua: 121&emsp;Use YueScript module in Lua:
122 122
123* **Case 1** 123* **Case 1**
124Require "your_yuescript_entry.yue" in Lua. 124Require "your_yuescript_entry.yue" in Lua.
125```Lua 125```Lua
126require("yue")("your_yuescript_entry") 126require("yue")("your_yuescript_entry")
127``` 127```
128&emsp;And this code still works when you compile "your_yuescript_entry.yue" to "your_yuescript_entry.lua" in the same path. In the rest Yuescript files just use the normal **require** or **import**. The code line numbers in error messages will also be handled correctly. 128&emsp;And this code still works when you compile "your_yuescript_entry.yue" to "your_yuescript_entry.lua" in the same path. In the rest YueScript files just use the normal **require** or **import**. The code line numbers in error messages will also be handled correctly.
129 129
130* **Case 2** 130* **Case 2**
131Require Yuescript module and rewite message by hand. 131Require YueScript module and rewite message by hand.
132```lua 132```lua
133local yue = require("yue") 133local yue = require("yue")
134local success, result = xpcall(function() 134local success, result = xpcall(function()
@@ -139,7 +139,7 @@ end)
139``` 139```
140 140
141* **Case 3** 141* **Case 3**
142Use the Yuescript compiler function in Lua. 142Use the YueScript compiler function in Lua.
143```lua 143```lua
144local yue = require("yue") 144local yue = require("yue")
145local codes, err, globals = yue.to_lua([[ 145local codes, err, globals = yue.to_lua([[
@@ -158,9 +158,9 @@ f!
158}) 158})
159``` 159```
160 160
161### Yuescript Tool 161### YueScript Tool
162 162
163&emsp;Use Yuescript tool with: 163&emsp;Use YueScript tool with:
164``` 164```
165> yue -h 165> yue -h
166Usage: yue [options|files|directories] ... 166Usage: yue [options|files|directories] ...
@@ -190,12 +190,12 @@ Usage: yue [options|files|directories] ...
190 in a single line to start/stop multi-line mode 190 in a single line to start/stop multi-line mode
191``` 191```
192&emsp;&emsp;Use cases: 192&emsp;&emsp;Use cases:
193&emsp;&emsp;Recursively compile every Yuescript file with extension **.yue** under current path: **yue .** 193&emsp;&emsp;Recursively compile every YueScript file with extension **.yue** under current path: **yue .**
194&emsp;&emsp;Compile and save results to a target path: **yue -t /target/path/ .** 194&emsp;&emsp;Compile and save results to a target path: **yue -t /target/path/ .**
195&emsp;&emsp;Compile and reserve debug info: **yue -l .** 195&emsp;&emsp;Compile and reserve debug info: **yue -l .**
196&emsp;&emsp;Compile and generate minified codes: **yue -m .** 196&emsp;&emsp;Compile and generate minified codes: **yue -m .**
197&emsp;&emsp;Execute raw codes: **yue -e 'print 123'** 197&emsp;&emsp;Execute raw codes: **yue -e 'print 123'**
198&emsp;&emsp;Execute a Yuescript file: **yue -e main.yue** 198&emsp;&emsp;Execute a YueScript file: **yue -e main.yue**
199 199
200## Macro 200## Macro
201 201
@@ -264,13 +264,13 @@ if $and f1!, f2!, f3!
264 264
265### Insert Raw Codes 265### Insert Raw Codes
266 266
267A macro function can either return a Yuescript string or a config table containing Lua codes. 267A macro function can either return a YueScript string or a config table containing Lua codes.
268```moonscript 268```moonscript
269macro yueFunc = (var)-> "local #{var} = ->" 269macro yueFunc = (var)-> "local #{var} = ->"
270$yueFunc funcA 270$yueFunc funcA
271funcA = -> "assign the Yue defined variable" 271funcA = -> "assign the Yue defined variable"
272 272
273-- take care and let Yuescript know the 273-- take care and let YueScript know the
274-- local variables you declared in Lua code 274-- local variables you declared in Lua code
275macro luaFunc = (var)-> { 275macro luaFunc = (var)-> {
276 code: "local function #{var}() end" 276 code: "local function #{var}() end"
@@ -299,7 +299,7 @@ macro yueFunc = (var)-> "local #{var} = ->"
299$yueFunc funcA 299$yueFunc funcA
300funcA = -> "assign the Yue defined variable" 300funcA = -> "assign the Yue defined variable"
301 301
302-- take care and let Yuescript know the 302-- take care and let YueScript know the
303-- local variables you declared in Lua codes 303-- local variables you declared in Lua codes
304macro luaFunc = (var)-> { 304macro luaFunc = (var)-> {
305 code: "local function #{var}() end" 305 code: "local function #{var}() end"
@@ -376,7 +376,7 @@ print $LINE -- get number 2
376 376
377### Generating Macros with Macros 377### Generating Macros with Macros
378 378
379In Yuescript, macro functions allow you to generate code at compile time. By nesting macro functions, you can create more complex generation patterns. This feature enables you to define a macro function that generates another macro function, allowing for more dynamic code generation. 379In YueScript, macro functions allow you to generate code at compile time. By nesting macro functions, you can create more complex generation patterns. This feature enables you to define a macro function that generates another macro function, allowing for more dynamic code generation.
380 380
381```moonscript 381```moonscript
382macro Enum = (...) -> 382macro Enum = (...) ->
@@ -1353,7 +1353,7 @@ print ok, count, first
1353 1353
1354## Whitespace 1354## Whitespace
1355 1355
1356Yuescript is a whitespace significant language. You have to write some code block in the same indent with space **' '** or tab **'\t'** like function body, value list and some control blocks. And expressions containing different whitespaces might mean different things. Tab is treated like 4 space, but it's better not mix the use of spaces and tabs. 1356YueScript is a whitespace significant language. You have to write some code block in the same indent with space **' '** or tab **'\t'** like function body, value list and some control blocks. And expressions containing different whitespaces might mean different things. Tab is treated like 4 space, but it's better not mix the use of spaces and tabs.
1357 1357
1358### Multiline Chaining 1358### Multiline Chaining
1359 1359
@@ -2778,7 +2778,7 @@ switch item
2778 2778
2779## Object Oriented Programming 2779## Object Oriented Programming
2780 2780
2781In these examples, the generated Lua code may appear overwhelming. It is best to focus on the meaning of the Yuescript code at first, then look into the Lua code if you wish to know the implementation details. 2781In these examples, the generated Lua code may appear overwhelming. It is best to focus on the meaning of the YueScript code at first, then look into the Lua code if you wish to know the implementation details.
2782 2782
2783A simple class: 2783A simple class:
2784 2784
@@ -3409,7 +3409,7 @@ print var -- nil here
3409</pre> 3409</pre>
3410</YueDisplay> 3410</YueDisplay>
3411 3411
3412Yuescript’s **do** can also be used an expression . Allowing you to combine multiple lines into one. The result of the do expression is the last statement in its body. 3412YueScript’s **do** can also be used an expression . Allowing you to combine multiple lines into one. The result of the do expression is the last statement in its body.
3413 3413
3414```moonscript 3414```moonscript
3415counter = do 3415counter = do
@@ -3591,7 +3591,7 @@ print i, k -- these have been updated
3591</pre> 3591</pre>
3592</YueDisplay> 3592</YueDisplay>
3593 3593
3594## The Yuescript Library 3594## The YueScript Library
3595 3595
3596Access it by `require("yue")`. 3596Access it by `require("yue")`.
3597 3597
@@ -3599,7 +3599,7 @@ Access it by `require("yue")`.
3599 3599
3600**Description:** 3600**Description:**
3601 3601
3602The Yuescript language library. 3602The YueScript language library.
3603 3603
3604#### version 3604#### version
3605 3605
@@ -3607,7 +3607,7 @@ The Yuescript language library.
3607 3607
3608**Description:** 3608**Description:**
3609 3609
3610The Yuescript version. 3610The YueScript version.
3611 3611
3612**Signature:** 3612**Signature:**
3613```lua 3613```lua
@@ -3646,7 +3646,7 @@ yue_compiled: {string: string}
3646 3646
3647**Description:** 3647**Description:**
3648 3648
3649The Yuescript compiling function. It compiles the Yuescript code to Lua code. 3649The YueScript compiling function. It compiles the YueScript code to Lua code.
3650 3650
3651**Signature:** 3651**Signature:**
3652```lua 3652```lua
@@ -3660,7 +3660,7 @@ to_lua: function(code: string, config?: Config):
3660 3660
3661| Parameter | Type | Description | 3661| Parameter | Type | Description |
3662| --- | --- | --- | 3662| --- | --- | --- |
3663| code | string | The Yuescript code. | 3663| code | string | The YueScript code. |
3664| config | Config | [Optional] The compiler options. | 3664| config | Config | [Optional] The compiler options. |
3665 3665
3666**Returns:** 3666**Returns:**
@@ -3727,7 +3727,7 @@ read_file: function(filename: string): string
3727 3727
3728**Description:** 3728**Description:**
3729 3729
3730Insert the Yuescript loader to the package loaders (searchers). 3730Insert the YueScript loader to the package loaders (searchers).
3731 3731
3732**Signature:** 3732**Signature:**
3733```lua 3733```lua
@@ -3752,7 +3752,7 @@ insert_loader: function(pos?: integer): boolean
3752 3752
3753**Description:** 3753**Description:**
3754 3754
3755Remove the Yuescript loader from the package loaders (searchers). 3755Remove the YueScript loader from the package loaders (searchers).
3756 3756
3757**Signature:** 3757**Signature:**
3758```lua 3758```lua
@@ -3771,7 +3771,7 @@ remove_loader: function(): boolean
3771 3771
3772**Description:** 3772**Description:**
3773 3773
3774Loads Yuescript code from a string into a function. 3774Loads YueScript code from a string into a function.
3775 3775
3776**Signature:** 3776**Signature:**
3777```lua 3777```lua
@@ -3784,7 +3784,7 @@ loadstring: function(input: string, chunkname: string, env: table, config?: Conf
3784 3784
3785| Parameter | Type | Description | 3785| Parameter | Type | Description |
3786| --- | --- | --- | 3786| --- | --- | --- |
3787| input | string | The Yuescript code. | 3787| input | string | The YueScript code. |
3788| chunkname | string | The name of the code chunk. | 3788| chunkname | string | The name of the code chunk. |
3789| env | table | The environment table. | 3789| env | table | The environment table. |
3790| config | Config | [Optional] The compiler options. | 3790| config | Config | [Optional] The compiler options. |
@@ -3802,7 +3802,7 @@ loadstring: function(input: string, chunkname: string, env: table, config?: Conf
3802 3802
3803**Description:** 3803**Description:**
3804 3804
3805Loads Yuescript code from a string into a function. 3805Loads YueScript code from a string into a function.
3806 3806
3807**Signature:** 3807**Signature:**
3808```lua 3808```lua
@@ -3815,7 +3815,7 @@ loadstring: function(input: string, chunkname: string, config?: Config):
3815 3815
3816| Parameter | Type | Description | 3816| Parameter | Type | Description |
3817| --- | --- | --- | 3817| --- | --- | --- |
3818| input | string | The Yuescript code. | 3818| input | string | The YueScript code. |
3819| chunkname | string | The name of the code chunk. | 3819| chunkname | string | The name of the code chunk. |
3820| config | Config | [Optional] The compiler options. | 3820| config | Config | [Optional] The compiler options. |
3821 3821
@@ -3832,7 +3832,7 @@ loadstring: function(input: string, chunkname: string, config?: Config):
3832 3832
3833**Description:** 3833**Description:**
3834 3834
3835Loads Yuescript code from a string into a function. 3835Loads YueScript code from a string into a function.
3836 3836
3837**Signature:** 3837**Signature:**
3838```lua 3838```lua
@@ -3845,7 +3845,7 @@ loadstring: function(input: string, config?: Config):
3845 3845
3846| Parameter | Type | Description | 3846| Parameter | Type | Description |
3847| --- | --- | --- | 3847| --- | --- | --- |
3848| input | string | The Yuescript code. | 3848| input | string | The YueScript code. |
3849| config | Config | [Optional] The compiler options. | 3849| config | Config | [Optional] The compiler options. |
3850 3850
3851**Returns:** 3851**Returns:**
@@ -3861,7 +3861,7 @@ loadstring: function(input: string, config?: Config):
3861 3861
3862**Description:** 3862**Description:**
3863 3863
3864Loads Yuescript code from a file into a function. 3864Loads YueScript code from a file into a function.
3865 3865
3866**Signature:** 3866**Signature:**
3867```lua 3867```lua
@@ -3891,7 +3891,7 @@ loadfile: function(filename: string, env: table, config?: Config):
3891 3891
3892**Description:** 3892**Description:**
3893 3893
3894Loads Yuescript code from a file into a function. 3894Loads YueScript code from a file into a function.
3895 3895
3896**Signature:** 3896**Signature:**
3897```lua 3897```lua
@@ -3920,7 +3920,7 @@ loadfile: function(filename: string, config?: Config):
3920 3920
3921**Description:** 3921**Description:**
3922 3922
3923Loads Yuescript code from a file into a function and executes it. 3923Loads YueScript code from a file into a function and executes it.
3924 3924
3925**Signature:** 3925**Signature:**
3926```lua 3926```lua
@@ -3947,7 +3947,7 @@ dofile: function(filename: string, env: table, config?: Config): any...
3947 3947
3948**Description:** 3948**Description:**
3949 3949
3950Loads Yuescript code from a file into a function and executes it. 3950Loads YueScript code from a file into a function and executes it.
3951 3951
3952**Signature:** 3952**Signature:**
3953```lua 3953```lua
@@ -3973,7 +3973,7 @@ dofile: function(filename: string, config?: Config): any...
3973 3973
3974**Description:** 3974**Description:**
3975 3975
3976Resolves the Yuescript module name to the file path. 3976Resolves the YueScript module name to the file path.
3977 3977
3978**Signature:** 3978**Signature:**
3979```lua 3979```lua
@@ -4000,7 +4000,7 @@ find_modulepath: function(name: string): string
4000 4000
4001Calls a function in protected mode. 4001Calls a function in protected mode.
4002Catches any errors and returns a status code and results or error object. 4002Catches any errors and returns a status code and results or error object.
4003Rewrites the error line number to the original line number in the Yuescript code when errors occur. 4003Rewrites the error line number to the original line number in the YueScript code when errors occur.
4004 4004
4005**Signature:** 4005**Signature:**
4006```lua 4006```lua
@@ -4026,8 +4026,8 @@ pcall: function(f: function, ...: any): boolean, any...
4026 4026
4027**Description:** 4027**Description:**
4028 4028
4029Loads a given module. Can be either a Lua module or a Yuescript module. 4029Loads a given module. Can be either a Lua module or a YueScript module.
4030Rewrites the error line number to the original line number in the Yuescript code if the module is a Yuescript module and loading fails. 4030Rewrites the error line number to the original line number in the YueScript code if the module is a YueScript module and loading fails.
4031 4031
4032**Signature:** 4032**Signature:**
4033```lua 4033```lua
@@ -4084,7 +4084,7 @@ options: Config.Options
4084 4084
4085**Description:** 4085**Description:**
4086 4086
4087The traceback function that rewrites the stack trace line numbers to the original line numbers in the Yuescript code. 4087The traceback function that rewrites the stack trace line numbers to the original line numbers in the YueScript code.
4088 4088
4089**Signature:** 4089**Signature:**
4090```lua 4090```lua
@@ -4178,8 +4178,8 @@ to_ast: function(code: string, flattenLevel?: number, astName?: string):
4178 4178
4179**Description:** 4179**Description:**
4180 4180
4181Requires the Yuescript module. 4181Requires the YueScript module.
4182Rewrites the error line number to the original line number in the Yuescript code when loading fails. 4182Rewrites the error line number to the original line number in the YueScript code when loading fails.
4183 4183
4184**Signature:** 4184**Signature:**
4185```lua 4185```lua
diff --git a/doc/docs/try/README.md b/doc/docs/try/README.md
index d6ba5dd..e931f96 100755
--- a/doc/docs/try/README.md
+++ b/doc/docs/try/README.md
@@ -1,6 +1,6 @@
1# Yuescript Online Compiler 1# YueScript Online Compiler
2--- 2---
3 3
4Try Yuescript in the browser with WASM. 4Try YueScript in the browser with WASM.
5 5
6<YueCompiler /> 6<YueCompiler />
diff --git a/doc/docs/zh/doc/README.md b/doc/docs/zh/doc/README.md
index c9233f6..355e468 100755
--- a/doc/docs/zh/doc/README.md
+++ b/doc/docs/zh/doc/README.md
@@ -9,7 +9,7 @@ title: 参考手册
9 9
10## 介绍 10## 介绍
11 11
12月之脚本(Yuescript)是一种动态语言,可以编译为Lua。它是[Moonscript](https://github.com/leafo/moonscript)的方言。用月之脚本编写的代码既有表现力又非常简洁。它适合编写一些更易于维护的代码,并在嵌入 Lua 的环境中运行,如游戏或网站服务器。 12月之脚本(YueScript)是一种动态语言,可以编译为Lua。它是[MoonScript](https://github.com/leafo/moonscript)的方言。用月之脚本编写的代码既有表现力又非常简洁。它适合编写一些更易于维护的代码,并在嵌入 Lua 的环境中运行,如游戏或网站服务器。
13 13
14Yue(月)是中文中“月亮”的名称。 14Yue(月)是中文中“月亮”的名称。
15 15
@@ -3602,7 +3602,7 @@ yue_compiled: {string: string}
3602 3602
3603**描述:** 3603**描述:**
3604 3604
3605月之脚本的编译函数。它将 Yuescript 代码编译为 Lua 代码。 3605月之脚本的编译函数。它将 YueScript 代码编译为 Lua 代码。
3606 3606
3607**签名:** 3607**签名:**
3608```lua 3608```lua
@@ -3616,7 +3616,7 @@ to_lua: function(code: string, config?: Config):
3616 3616
3617| 参数名 | 类型 | 描述 | 3617| 参数名 | 类型 | 描述 |
3618| --- | --- | --- | 3618| --- | --- | --- |
3619| code | string | Yuescript 代码。 | 3619| code | string | YueScript 代码。 |
3620| config | Config | [可选] 编译器选项。 | 3620| config | Config | [可选] 编译器选项。 |
3621 3621
3622**返回值:** 3622**返回值:**
@@ -3683,7 +3683,7 @@ read_file: function(filename: string): string
3683 3683
3684**描述:** 3684**描述:**
3685 3685
3686将 Yuescript 加载器插入到 Lua 包加载器(搜索器)中。 3686将 YueScript 加载器插入到 Lua 包加载器(搜索器)中。
3687 3687
3688**签名:** 3688**签名:**
3689```lua 3689```lua
@@ -3708,7 +3708,7 @@ insert_loader: function(pos?: integer): boolean
3708 3708
3709**描述:** 3709**描述:**
3710 3710
3711从 Lua 包加载器(搜索器)中移除 Yuescript 加载器。 3711从 Lua 包加载器(搜索器)中移除 YueScript 加载器。
3712 3712
3713**签名:** 3713**签名:**
3714```lua 3714```lua
@@ -3727,7 +3727,7 @@ remove_loader: function(): boolean
3727 3727
3728**描述:** 3728**描述:**
3729 3729
3730将 Yuescript 代码字符串加载为一个函数。 3730将 YueScript 代码字符串加载为一个函数。
3731 3731
3732**签名:** 3732**签名:**
3733```lua 3733```lua
@@ -3740,7 +3740,7 @@ loadstring: function(input: string, chunkname: string, env: table, config?: Conf
3740 3740
3741| 参数名 | 类型 | 描述 | 3741| 参数名 | 类型 | 描述 |
3742| --- | --- | --- | 3742| --- | --- | --- |
3743| input | string | Yuescript 代码。 | 3743| input | string | YueScript 代码。 |
3744| chunkname | string | 代码块的名称。 | 3744| chunkname | string | 代码块的名称。 |
3745| env | table | 环境表。 | 3745| env | table | 环境表。 |
3746| config | Config | [可选] 编译器选项。 | 3746| config | Config | [可选] 编译器选项。 |
@@ -3758,7 +3758,7 @@ loadstring: function(input: string, chunkname: string, env: table, config?: Conf
3758 3758
3759**描述:** 3759**描述:**
3760 3760
3761将 Yuescript 代码字符串加载为一个函数。 3761将 YueScript 代码字符串加载为一个函数。
3762 3762
3763**签名:** 3763**签名:**
3764```lua 3764```lua
@@ -3771,7 +3771,7 @@ loadstring: function(input: string, chunkname: string, config?: Config):
3771 3771
3772| 参数名 | 类型 | 描述 | 3772| 参数名 | 类型 | 描述 |
3773| --- | --- | --- | 3773| --- | --- | --- |
3774| input | string | Yuescript 代码。 | 3774| input | string | YueScript 代码。 |
3775| chunkname | string | 代码块的名称。 | 3775| chunkname | string | 代码块的名称。 |
3776| config | Config | [可选] 编译器选项。 | 3776| config | Config | [可选] 编译器选项。 |
3777 3777
@@ -3788,7 +3788,7 @@ loadstring: function(input: string, chunkname: string, config?: Config):
3788 3788
3789**描述:** 3789**描述:**
3790 3790
3791将 Yuescript 代码字符串加载为一个函数。 3791将 YueScript 代码字符串加载为一个函数。
3792 3792
3793**签名:** 3793**签名:**
3794```lua 3794```lua
@@ -3801,7 +3801,7 @@ loadstring: function(input: string, config?: Config):
3801 3801
3802| 参数名 | 类型 | 描述 | 3802| 参数名 | 类型 | 描述 |
3803| --- | --- | --- | 3803| --- | --- | --- |
3804| input | string | Yuescript 代码。 | 3804| input | string | YueScript 代码。 |
3805| config | Config | [可选] 编译器选项。 | 3805| config | Config | [可选] 编译器选项。 |
3806 3806
3807**返回值:** 3807**返回值:**
@@ -3817,7 +3817,7 @@ loadstring: function(input: string, config?: Config):
3817 3817
3818**描述:** 3818**描述:**
3819 3819
3820将 Yuescript 代码文件加载为一个函数。 3820将 YueScript 代码文件加载为一个函数。
3821 3821
3822**签名:** 3822**签名:**
3823```lua 3823```lua
@@ -3847,7 +3847,7 @@ loadfile: function(filename: string, env: table, config?: Config):
3847 3847
3848**描述:** 3848**描述:**
3849 3849
3850将 Yuescript 代码文件加载为一个函数。 3850将 YueScript 代码文件加载为一个函数。
3851 3851
3852**签名:** 3852**签名:**
3853```lua 3853```lua
@@ -3876,7 +3876,7 @@ loadfile: function(filename: string, config?: Config):
3876 3876
3877**描述:** 3877**描述:**
3878 3878
3879将 Yuescript 代码文件加载为一个函数并执行。 3879将 YueScript 代码文件加载为一个函数并执行。
3880 3880
3881**签名:** 3881**签名:**
3882```lua 3882```lua
@@ -3903,7 +3903,7 @@ dofile: function(filename: string, env: table, config?: Config): any...
3903 3903
3904**描述:** 3904**描述:**
3905 3905
3906将 Yuescript 代码文件加载为一个函数并执行。 3906将 YueScript 代码文件加载为一个函数并执行。
3907 3907
3908**签名:** 3908**签名:**
3909```lua 3909```lua
@@ -3929,7 +3929,7 @@ dofile: function(filename: string, config?: Config): any...
3929 3929
3930**描述:** 3930**描述:**
3931 3931
3932将 Yuescript 模块名解析为文件路径。 3932将 YueScript 模块名解析为文件路径。
3933 3933
3934**签名:** 3934**签名:**
3935```lua 3935```lua
@@ -3956,7 +3956,7 @@ find_modulepath: function(name: string): string
3956 3956
3957在保护模式下调用一个函数。 3957在保护模式下调用一个函数。
3958会捕获任何错误,执行成功则返回成功状态和结果,否则为失败状态和错误信息。 3958会捕获任何错误,执行成功则返回成功状态和结果,否则为失败状态和错误信息。
3959当发生错误时,将错误信息中的代码行号重写为 Yuescript 代码中的原始行号。 3959当发生错误时,将错误信息中的代码行号重写为 YueScript 代码中的原始行号。
3960 3960
3961**签名:** 3961**签名:**
3962```lua 3962```lua
@@ -3982,8 +3982,8 @@ pcall: function(f: function, ...: any): boolean, any...
3982 3982
3983**描述:** 3983**描述:**
3984 3984
3985加载给定的模块。可以是 Lua 模块或 Yuescript 模块。 3985加载给定的模块。可以是 Lua 模块或 YueScript 模块。
3986如果模块是 Yuescript 模块且加载失败,则将错误信息中的代码行号重写为 Yuescript 代码中的原始行号。 3986如果模块是 YueScript 模块且加载失败,则将错误信息中的代码行号重写为 YueScript 代码中的原始行号。
3987 3987
3988**签名:** 3988**签名:**
3989```lua 3989```lua
@@ -4040,7 +4040,7 @@ options: Config.Options
4040 4040
4041**描述:** 4041**描述:**
4042 4042
4043重写堆栈跟踪中的行号为 Yuescript 代码中的原始行号的 traceback 函数。 4043重写堆栈跟踪中的行号为 YueScript 代码中的原始行号的 traceback 函数。
4044 4044
4045**签名:** 4045**签名:**
4046```lua 4046```lua
@@ -4126,8 +4126,8 @@ to_ast: function(code: string, flattenLevel?: number, astName?: string):
4126 4126
4127**描述:** 4127**描述:**
4128 4128
4129导入 Yuescript 模块。 4129导入 YueScript 模块。
4130如果发生加载失败,则将错误信息中的代码行号重写为 Yuescript 代码中的原始行号。 4130如果发生加载失败,则将错误信息中的代码行号重写为 YueScript 代码中的原始行号。
4131 4131
4132**签名:** 4132**签名:**
4133```lua 4133```lua
diff --git a/doc/docs/zh/try/README.md b/doc/docs/zh/try/README.md
index c42e5a9..46667a8 100755
--- a/doc/docs/zh/try/README.md
+++ b/doc/docs/zh/try/README.md
@@ -1,6 +1,6 @@
1# 月之脚本的在线编译器 1# 月之脚本的在线编译器
2--- 2---
3 3
4在这里试试 WASM 版的 Yuescript 吧。 4在这里试试 WASM 版的 YueScript 吧。
5 5
6<YueCompiler /> 6<YueCompiler />