aboutsummaryrefslogtreecommitdiff
path: root/doc/docs/de
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2026-02-06 11:54:32 +0800
committerLi Jin <dragon-fly@qq.com>2026-02-06 11:54:32 +0800
commit1f83d504bc344ffd3c8b4120b3865fd6c11a9e2d (patch)
tree1d5c39eadcbe086d2a592ac76c8f1d288adfbe9d /doc/docs/de
parentaa3ecc7badfb39cb9167fb95c9a678257c1d9954 (diff)
downloadyuescript-1f83d504bc344ffd3c8b4120b3865fd6c11a9e2d.tar.gz
yuescript-1f83d504bc344ffd3c8b4120b3865fd6c11a9e2d.tar.bz2
yuescript-1f83d504bc344ffd3c8b4120b3865fd6c11a9e2d.zip
Updated docs.v0.32.9
Diffstat (limited to 'doc/docs/de')
-rw-r--r--doc/docs/de/doc/advanced/do.md16
-rw-r--r--doc/docs/de/doc/advanced/line-decorators.md16
-rw-r--r--doc/docs/de/doc/advanced/macro.md115
-rw-r--r--doc/docs/de/doc/advanced/module.md74
-rw-r--r--doc/docs/de/doc/advanced/try.md28
-rw-r--r--doc/docs/de/doc/assignment/assignment.md28
-rw-r--r--doc/docs/de/doc/assignment/destructuring-assignment.md90
-rw-r--r--doc/docs/de/doc/assignment/if-assignment.md35
-rw-r--r--doc/docs/de/doc/assignment/the-using-clause-controlling-destructive-assignment.md36
-rw-r--r--doc/docs/de/doc/assignment/varargs-assignment.md4
-rw-r--r--doc/docs/de/doc/control-flow/conditionals.md65
-rw-r--r--doc/docs/de/doc/control-flow/continue.md4
-rw-r--r--doc/docs/de/doc/control-flow/for-loop.md36
-rw-r--r--doc/docs/de/doc/control-flow/switch.md130
-rw-r--r--doc/docs/de/doc/control-flow/while-loop.md10
-rw-r--r--doc/docs/de/doc/data-structures/comprehensions.md74
-rw-r--r--doc/docs/de/doc/data-structures/table-literals.md64
-rw-r--r--doc/docs/de/doc/functions/backcalls.md16
-rw-r--r--doc/docs/de/doc/functions/function-literals.md161
-rw-r--r--doc/docs/de/doc/functions/function-stubs.md32
-rw-r--r--doc/docs/de/doc/getting-started/installation.md22
-rw-r--r--doc/docs/de/doc/getting-started/introduction.md56
-rw-r--r--doc/docs/de/doc/getting-started/usage.md124
-rw-r--r--doc/docs/de/doc/language-basics/attributes.md12
-rw-r--r--doc/docs/de/doc/language-basics/comment.md26
-rw-r--r--doc/docs/de/doc/language-basics/literals.md42
-rw-r--r--doc/docs/de/doc/language-basics/operator.md143
-rw-r--r--doc/docs/de/doc/language-basics/whitespace.md12
-rw-r--r--doc/docs/de/doc/objects/object-oriented-programming.md204
-rw-r--r--doc/docs/de/doc/objects/with-statement.md43
-rw-r--r--doc/docs/de/doc/reference/license-mit.md24
-rw-r--r--doc/docs/de/doc/reference/the-yuescript-library.md632
32 files changed, 1180 insertions, 1194 deletions
diff --git a/doc/docs/de/doc/advanced/do.md b/doc/docs/de/doc/advanced/do.md
index 4990d6f..6f81f9d 100644
--- a/doc/docs/de/doc/advanced/do.md
+++ b/doc/docs/de/doc/advanced/do.md
@@ -1,25 +1,25 @@
1# Do 1# Do
2 2
3When used as a statement, do works just like it does in Lua. 3Als Statement verlt sich `do` wie in Lua.
4 4
5```yuescript 5```yuescript
6do 6do
7 var = "hello" 7 var = "hallo"
8 print var 8 print var
9print var -- nil here 9print var -- nil hier
10``` 10```
11<YueDisplay> 11<YueDisplay>
12 12
13```yue 13```yue
14do 14do
15 var = "hello" 15 var = "hallo"
16 print var 16 print var
17print var -- nil here 17print var -- nil hier
18``` 18```
19 19
20</YueDisplay> 20</YueDisplay>
21 21
22YueScript'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. 22YueScripts **do** kann auch als Ausdruck verwendet werden. So kannst du mehrere Zeilen in einem Ausdruck kombinieren. Das Ergebnis des `do`-Ausdrucks ist die letzte Anweisung im Block.
23 23
24```yuescript 24```yuescript
25counter = do 25counter = do
@@ -49,7 +49,7 @@ print counter!
49```yuescript 49```yuescript
50tbl = { 50tbl = {
51 key: do 51 key: do
52 print "assigning key!" 52 print "Schlüssel wird zugewiesen!"
53 1234 53 1234
54} 54}
55``` 55```
@@ -58,7 +58,7 @@ tbl = {
58```yue 58```yue
59tbl = { 59tbl = {
60 key: do 60 key: do
61 print "assigning key!" 61 print "Schlüssel wird zugewiesen!"
62 1234 62 1234
63} 63}
64``` 64```
diff --git a/doc/docs/de/doc/advanced/line-decorators.md b/doc/docs/de/doc/advanced/line-decorators.md
index 292bc77..dd26925 100644
--- a/doc/docs/de/doc/advanced/line-decorators.md
+++ b/doc/docs/de/doc/advanced/line-decorators.md
@@ -1,32 +1,32 @@
1# Line Decorators 1# Line-Decorators
2 2
3For convenience, the for loop and if statement can be applied to single statements at the end of the line: 3Zur Vereinfachung können `for`-Schleifen und `if`-Anweisungen auf einzelne Anweisungen am Zeilenende angewendet werden:
4 4
5```yuescript 5```yuescript
6print "hello world" if name == "Rob" 6print "Hallo Welt" if name == "Rob"
7``` 7```
8<YueDisplay> 8<YueDisplay>
9 9
10```yue 10```yue
11print "hello world" if name == "Rob" 11print "Hallo Welt" if name == "Rob"
12``` 12```
13 13
14</YueDisplay> 14</YueDisplay>
15 15
16And with basic loops: 16Und mit einfachen Schleifen:
17 17
18```yuescript 18```yuescript
19print "item: ", item for item in *items 19print "Element: ", item for item in *items
20``` 20```
21<YueDisplay> 21<YueDisplay>
22 22
23```yue 23```yue
24print "item: ", item for item in *items 24print "Element: ", item for item in *items
25``` 25```
26 26
27</YueDisplay> 27</YueDisplay>
28 28
29And with while loops: 29Und mit `while`-Schleifen:
30 30
31```yuescript 31```yuescript
32game\update! while game\isRunning! 32game\update! while game\isRunning!
diff --git a/doc/docs/de/doc/advanced/macro.md b/doc/docs/de/doc/advanced/macro.md
index 6d194c3..a3e155a 100644
--- a/doc/docs/de/doc/advanced/macro.md
+++ b/doc/docs/de/doc/advanced/macro.md
@@ -1,14 +1,14 @@
1# Macro 1# Makros
2 2
3## Common Usage 3## Häufige Verwendung
4 4
5Macro function is used for evaluating a string in the compile time and insert the generated codes into final compilation. 5Makrofunktionen werden verwendet, um zur Compile-Zeit einen String auszuwerten und den generierten Code in die finale Kompilierung einzufügen.
6 6
7```yuescript 7```yuescript
8macro PI2 = -> math.pi * 2 8macro PI2 = -> math.pi * 2
9area = $PI2 * 5 9area = $PI2 * 5
10 10
11macro HELLO = -> "'hello world'" 11macro HELLO = -> "'Hallo Welt'"
12print $HELLO 12print $HELLO
13 13
14macro config = (debugging) -> 14macro config = (debugging) ->
@@ -27,7 +27,7 @@ $asserts item ~= nil
27$config false 27$config false
28value = $assert item 28value = $assert item
29 29
30-- the passed expressions are treated as strings 30-- übergebene Ausdrücke werden als Strings behandelt
31macro and = (...) -> "#{ table.concat {...}, ' and ' }" 31macro and = (...) -> "#{ table.concat {...}, ' and ' }"
32if $and f1!, f2!, f3! 32if $and f1!, f2!, f3!
33 print "OK" 33 print "OK"
@@ -38,7 +38,7 @@ if $and f1!, f2!, f3!
38macro PI2 = -> math.pi * 2 38macro PI2 = -> math.pi * 2
39area = $PI2 * 5 39area = $PI2 * 5
40 40
41macro HELLO = -> "'hello world'" 41macro HELLO = -> "'Hallo Welt'"
42print $HELLO 42print $HELLO
43 43
44macro config = (debugging) -> 44macro config = (debugging) ->
@@ -57,7 +57,7 @@ $asserts item ~= nil
57$config false 57$config false
58value = $assert item 58value = $assert item
59 59
60-- the passed expressions are treated as strings 60-- übergebene Ausdrücke werden als Strings behandelt
61macro and = (...) -> "#{ table.concat {...}, ' and ' }" 61macro and = (...) -> "#{ table.concat {...}, ' and ' }"
62if $and f1!, f2!, f3! 62if $and f1!, f2!, f3!
63 print "OK" 63 print "OK"
@@ -65,31 +65,32 @@ if $and f1!, f2!, f3!
65 65
66</YueDisplay> 66</YueDisplay>
67 67
68## Insert Raw Codes 68## Rohcode einfügen
69
70Eine Makrofunktion kann entweder einen YueScript-String oder eine Konfigurationstabelle mit Lua-Code zurückgeben.
69 71
70A macro function can either return a YueScript string or a config table containing Lua codes.
71```yuescript 72```yuescript
72macro yueFunc = (var) -> "local #{var} = ->" 73macro yueFunc = (var) -> "local #{var} = ->"
73$yueFunc funcA 74$yueFunc funcA
74funcA = -> "fail to assign to the Yue macro defined variable" 75funcA = -> "Zuweisung an die vom Yue-Makro definierte Variable schlägt fehl"
75 76
76macro luaFunc = (var) -> { 77macro luaFunc = (var) -> {
77 code: "local function #{var}() end" 78 code: "local function #{var}() end"
78 type: "lua" 79 type: "lua"
79} 80}
80$luaFunc funcB 81$luaFunc funcB
81funcB = -> "fail to assign to the Lua macro defined variable" 82funcB = -> "Zuweisung an die vom Lua-Makro definierte Variable schlägt fehl"
82 83
83macro lua = (code) -> { 84macro lua = (code) -> {
84 :code 85 :code
85 type: "lua" 86 type: "lua"
86} 87}
87 88
88-- the raw string leading and ending symbols are auto trimed 89-- hrende und abschließende Symbole des Raw-Strings werden automatisch getrimmt
89$lua[==[ 90$lua[==[
90-- raw Lua codes insertion 91-- Einfügen von rohem Lua-Code
91if cond then 92if cond then
92 print("output") 93 print("Ausgabe")
93end 94end
94]==] 95]==]
95``` 96```
@@ -98,63 +99,64 @@ end
98```yue 99```yue
99macro yueFunc = (var) -> "local #{var} = ->" 100macro yueFunc = (var) -> "local #{var} = ->"
100$yueFunc funcA 101$yueFunc funcA
101funcA = -> "fail to assign to the Yue macro defined variable" 102funcA = -> "Zuweisung an die vom Yue-Makro definierte Variable schlägt fehl"
102 103
103macro luaFunc = (var) -> { 104macro luaFunc = (var) -> {
104 code: "local function #{var}() end" 105 code: "local function #{var}() end"
105 type: "lua" 106 type: "lua"
106} 107}
107$luaFunc funcB 108$luaFunc funcB
108funcB = -> "fail to assign to the Lua macro defined variable" 109funcB = -> "Zuweisung an die vom Lua-Makro definierte Variable schlägt fehl"
109 110
110macro lua = (code) -> { 111macro lua = (code) -> {
111 :code 112 :code
112 type: "lua" 113 type: "lua"
113} 114}
114 115
115-- the raw string leading and ending symbols are auto trimed 116-- hrende und abschließende Symbole des Raw-Strings werden automatisch getrimmt
116$lua[==[ 117$lua[==[
117-- raw Lua codes insertion 118-- Einfügen von rohem Lua-Code
118if cond then 119if cond then
119 print("output") 120 print("Ausgabe")
120end 121end
121]==] 122]==]
122``` 123```
123 124
124</YueDisplay> 125</YueDisplay>
125 126
126## Export Macro 127## Makros exportieren
128
129Makrofunktionen können aus einem Modul exportiert und in ein anderes Modul importiert werden. Exportierte Makros müssen in einer einzelnen Datei liegen, und im Export-Modul dürfen nur Makrodefinitionen, Makro-Imports und Makro-Expansionen stehen.
127 130
128Macro functions can be exported from a module and get imported in another module. You have to put export macro functions in a single file to be used, and only macro definition, macro importing and macro expansion in place can be put into the macro exporting module.
129```yuescript 131```yuescript
130-- file: utils.yue 132-- Datei: utils.yue
131export macro map = (items, action) -> "[#{action} for _ in *#{items}]" 133export macro map = (items, action) -> "[#{action} for _ in *#{items}]"
132export macro filter = (items, action) -> "[_ for _ in *#{items} when #{action}]" 134export macro filter = (items, action) -> "[_ for _ in *#{items} when #{action}]"
133export macro foreach = (items, action) -> "for _ in *#{items} 135export macro foreach = (items, action) -> "for _ in *#{items}
134 #{action}" 136 #{action}"
135 137
136-- file main.yue 138-- Datei main.yue
137import "utils" as { 139import "utils" as {
138 $, -- symbol to import all macros 140 $, -- Symbol zum Importieren aller Makros
139 $foreach: $each -- rename macro $foreach to $each 141 $foreach: $each -- Makro $foreach in $each umbenennen
140} 142}
141[1, 2, 3] |> $map(_ * 2) |> $filter(_ > 4) |> $each print _ 143[1, 2, 3] |> $map(_ * 2) |> $filter(_ > 4) |> $each print _
142``` 144```
143<YueDisplay> 145<YueDisplay>
144 146
145```yue 147```yue
146-- file: utils.yue 148-- Datei: utils.yue
147export macro map = (items, action) -> "[#{action} for _ in *#{items}]" 149export macro map = (items, action) -> "[#{action} for _ in *#{items}]"
148export macro filter = (items, action) -> "[_ for _ in *#{items} when #{action}]" 150export macro filter = (items, action) -> "[_ for _ in *#{items} when #{action}]"
149export macro foreach = (items, action) -> "for _ in *#{items} 151export macro foreach = (items, action) -> "for _ in *#{items}
150 #{action}" 152 #{action}"
151 153
152-- file main.yue 154-- Datei main.yue
153-- import function is not available in browser, try it in a real environment 155-- Import-Funktion im Browser nicht verfügbar, in echter Umgebung testen
154--[[ 156--[[
155import "utils" as { 157import "utils" as {
156 $, -- symbol to import all macros 158 $, -- Symbol zum Importieren aller Makros
157 $foreach: $each -- rename macro $foreach to $each 159 $foreach: $each -- Makro $foreach in $each umbenennen
158} 160}
159[1, 2, 3] |> $map(_ * 2) |> $filter(_ > 4) |> $each print _ 161[1, 2, 3] |> $map(_ * 2) |> $filter(_ > 4) |> $each print _
160]] 162]]
@@ -162,32 +164,33 @@ import "utils" as {
162 164
163</YueDisplay> 165</YueDisplay>
164 166
165## Builtin Macro 167## Eingebaute Makros
168
169Es gibt einige eingebaute Makros, aber du kannst sie überschreiben, indem du Makros mit denselben Namen deklarierst.
166 170
167There are some builtin macros but you can override them by declaring macros with the same names.
168```yuescript 171```yuescript
169print $FILE -- get string of current module name 172print $FILE -- String des aktuellen Modulnamens
170print $LINE -- get number 2 173print $LINE -- gibt 2 aus
171``` 174```
172<YueDisplay> 175<YueDisplay>
173 176
174```yue 177```yue
175print $FILE -- get string of current module name 178print $FILE -- String des aktuellen Modulnamens
176print $LINE -- get number 2 179print $LINE -- gibt 2 aus
177``` 180```
178 181
179</YueDisplay> 182</YueDisplay>
180 183
181## Generating Macros with Macros 184## Makros mit Makros erzeugen
182 185
183In 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. 186In YueScript erlauben Makrofunktionen Codegenerierung zur Compile-Zeit. Durch das Verschachteln von Makrofunktionen kannst du komplexere Generierungsmuster erzeugen. Damit kannst du eine Makrofunktion definieren, die eine andere Makrofunktion erzeugt.
184 187
185```yuescript 188```yuescript
186macro Enum = (...) -> 189macro Enum = (...) ->
187 items = {...} 190 items = {...}
188 itemSet = {item, true for item in *items} 191 itemSet = {item, true for item in *items}
189 (item) -> 192 (item) ->
190 error "got \"#{item}\", expecting one of #{table.concat items, ', '}" unless itemSet[item] 193 error "erhalten: \"#{item}\", erwartet eines von #{table.concat items, ', '}" unless itemSet[item]
191 "\"#{item}\"" 194 "\"#{item}\""
192 195
193macro BodyType = $Enum( 196macro BodyType = $Enum(
@@ -196,8 +199,8 @@ macro BodyType = $Enum(
196 Kinematic 199 Kinematic
197) 200)
198 201
199print "Valid enum type:", $BodyType Static 202print "ltiger Enum-Typ:", $BodyType Static
200-- print "Compilation error with enum type:", $BodyType Unknown 203-- print "Kompilierungsfehler bei Enum-Typ:", $BodyType Unknown
201``` 204```
202 205
203<YueDisplay> 206<YueDisplay>
@@ -207,7 +210,7 @@ macro Enum = (...) ->
207 items = {...} 210 items = {...}
208 itemSet = {item, true for item in *items} 211 itemSet = {item, true for item in *items}
209 (item) -> 212 (item) ->
210 error "got \"#{item}\", expecting one of #{table.concat items, ', '}" unless itemSet[item] 213 error "erhalten: \"#{item}\", erwartet eines von #{table.concat items, ', '}" unless itemSet[item]
211 "\"#{item}\"" 214 "\"#{item}\""
212 215
213macro BodyType = $Enum( 216macro BodyType = $Enum(
@@ -216,15 +219,15 @@ macro BodyType = $Enum(
216 Kinematic 219 Kinematic
217) 220)
218 221
219print "Valid enum type:", $BodyType Static 222print "ltiger Enum-Typ:", $BodyType Static
220-- print "Compilation error with enum type:", $BodyType Unknown 223-- print "Kompilierungsfehler bei Enum-Typ:", $BodyType Unknown
221``` 224```
222 225
223</YueDisplay> 226</YueDisplay>
224 227
225## Argument Validation 228## Argument-Validierung
226 229
227You can declare the expected AST node types in the argument list, and check whether the incoming macro arguments meet the expectations at compile time. 230Du kannst erwartete AST-Knotentypen in der Argumentliste deklarieren und zur Compile-Zeit prüfen, ob die übergebenen Makroargumente den Erwartungen entsprechen.
228 231
229```yuescript 232```yuescript
230macro printNumAndStr = (num `Num, str `String) -> | 233macro printNumAndStr = (num `Num, str `String) -> |
@@ -233,7 +236,7 @@ macro printNumAndStr = (num `Num, str `String) -> |
233 #{str} 236 #{str}
234 ) 237 )
235 238
236$printNumAndStr 123, "hello" 239$printNumAndStr 123, "hallo"
237``` 240```
238<YueDisplay> 241<YueDisplay>
239 242
@@ -244,32 +247,32 @@ macro printNumAndStr = (num `Num, str `String) -> |
244 #{str} 247 #{str}
245 ) 248 )
246 249
247$printNumAndStr 123, "hello" 250$printNumAndStr 123, "hallo"
248``` 251```
249 252
250</YueDisplay> 253</YueDisplay>
251 254
252If you need more flexible argument checking, you can use the built-in `$is_ast` macro function to manually check at the appropriate place. 255Wenn du flexiblere Argumentprüfungen brauchst, kannst du das eingebaute Makro `$is_ast` verwenden, um manuell an der passenden Stelle zu prüfen.
253 256
254```yuescript 257```yuescript
255macro printNumAndStr = (num, str) -> 258macro printNumAndStr = (num, str) ->
256 error "expected Num as first argument" unless $is_ast Num, num 259 error "als erstes Argument Num erwartet" unless $is_ast Num, num
257 error "expected String as second argument" unless $is_ast String, str 260 error "als zweites Argument String erwartet" unless $is_ast String, str
258 "print(#{num}, #{str})" 261 "print(#{num}, #{str})"
259 262
260$printNumAndStr 123, "hello" 263$printNumAndStr 123, "hallo"
261``` 264```
262<YueDisplay> 265<YueDisplay>
263 266
264```yue 267```yue
265macro printNumAndStr = (num, str) -> 268macro printNumAndStr = (num, str) ->
266 error "expected Num as first argument" unless $is_ast Num, num 269 error "als erstes Argument Num erwartet" unless $is_ast Num, num
267 error "expected String as second argument" unless $is_ast String, str 270 error "als zweites Argument String erwartet" unless $is_ast String, str
268 "print(#{num}, #{str})" 271 "print(#{num}, #{str})"
269 272
270$printNumAndStr 123, "hello" 273$printNumAndStr 123, "hallo"
271``` 274```
272 275
273</YueDisplay> 276</YueDisplay>
274 277
275For more details about available AST nodes, please refer to the uppercased definitions in [yue_parser.cpp](https://github.com/IppClub/YueScript/blob/main/src/yuescript/yue_parser.cpp). 278Weitere Details zu verfügbaren AST-Knoten findest du in den großgeschriebenen Definitionen in `yue_parser.cpp`.
diff --git a/doc/docs/de/doc/advanced/module.md b/doc/docs/de/doc/advanced/module.md
index c955092..bdc5d86 100644
--- a/doc/docs/de/doc/advanced/module.md
+++ b/doc/docs/de/doc/advanced/module.md
@@ -2,27 +2,27 @@
2 2
3## Import 3## Import
4 4
5The import statement is a syntax sugar for requiring a module or help extracting items from an imported module. The imported items are const by default. 5Die `import`-Anweisung ist syntaktischer Zucker für `require` und hilft beim Extrahieren von Einträgen aus importierten Modulen. Importierte Elemente sind standardmäßig `const`.
6 6
7```yuescript 7```yuescript
8-- used as table destructuring 8-- als Tabellen-Destrukturierung
9do 9do
10 import insert, concat from table 10 import insert, concat from table
11 -- report error when assigning to insert, concat 11 -- Fehler beim Zuweisen zu insert, concat
12 import C, Ct, Cmt from require "lpeg" 12 import C, Ct, Cmt from require "lpeg"
13 -- shortcut for implicit requiring 13 -- Kurzform für implizites Require
14 import x, y, z from 'mymodule' 14 import x, y, z from 'mymodule'
15 -- import with Python style 15 -- Import im Python-Stil
16 from 'module' import a, b, c 16 from 'module' import a, b, c
17 17
18-- shortcut for requring a module 18-- Kurzform zum Laden eines Moduls
19do 19do
20 import 'module' 20 import 'module'
21 import 'module_x' 21 import 'module_x'
22 import "d-a-s-h-e-s" 22 import "d-a-s-h-e-s"
23 import "module.part" 23 import "module.part"
24 24
25-- requring module with aliasing or table destructuring 25-- Modul mit Alias oder Tabellen-Destrukturierung laden
26do 26do
27 import "player" as PlayerModule 27 import "player" as PlayerModule
28 import "lpeg" as :C, :Ct, :Cmt 28 import "lpeg" as :C, :Ct, :Cmt
@@ -31,24 +31,24 @@ do
31<YueDisplay> 31<YueDisplay>
32 32
33```yue 33```yue
34-- used as table destructuring 34-- als Tabellen-Destrukturierung
35do 35do
36 import insert, concat from table 36 import insert, concat from table
37 -- report error when assigning to insert, concat 37 -- Fehler beim Zuweisen zu insert, concat
38 import C, Ct, Cmt from require "lpeg" 38 import C, Ct, Cmt from require "lpeg"
39 -- shortcut for implicit requiring 39 -- Kurzform für implizites Require
40 import x, y, z from 'mymodule' 40 import x, y, z from 'mymodule'
41 -- import with Python style 41 -- Import im Python-Stil
42 from 'module' import a, b, c 42 from 'module' import a, b, c
43 43
44-- shortcut for requring a module 44-- Kurzform zum Laden eines Moduls
45do 45do
46 import 'module' 46 import 'module'
47 import 'module_x' 47 import 'module_x'
48 import "d-a-s-h-e-s" 48 import "d-a-s-h-e-s"
49 import "module.part" 49 import "module.part"
50 50
51-- requring module with aliasing or table destructuring 51-- Modul mit Alias oder Tabellen-Destrukturierung laden
52do 52do
53 import "player" as PlayerModule 53 import "player" as PlayerModule
54 import "lpeg" as :C, :Ct, :Cmt 54 import "lpeg" as :C, :Ct, :Cmt
@@ -57,9 +57,9 @@ do
57 57
58</YueDisplay> 58</YueDisplay>
59 59
60## Import Global 60## Import von Globals
61 61
62You can import specific globals into local variables with `import`. When importing a chain of global variable accessings, the last field will be assigned to the local variable. 62Du kannst mit `import` bestimmte Globals in lokale Variablen importieren. Wenn du eine Kette von Globalzugriffen importierst, wird das letzte Feld der lokalen Variable zugewiesen.
63 63
64```yuescript 64```yuescript
65do 65do
@@ -78,21 +78,21 @@ do
78 78
79</YueDisplay> 79</YueDisplay>
80 80
81### Automatic Global Variable Import 81### Automatischer Global-Import
82 82
83You can place `import global` at the top of a block to automatically import all names that have not been explicitly declared or assigned in the current scope as globals. These implicit imports are treated as local consts that reference the corresponding globals at the position of the statement. 83Du kannst `import global` am Anfang eines Blocks platzieren, um automatisch alle Namen zu importieren, die im aktuellen Scope nicht explizit deklariert oder zugewiesen sind. Diese impliziten Importe werden als lokale `const` behandelt, die an die entsprechenden Globals zum Zeitpunkt der Anweisung gebunden sind.
84 84
85Names that are explicitly declared as globals in the same scope will not be imported, so you can still assign to them. 85Namen, die im selben Scope explizit als `global` deklariert werden, werden nicht importiert, sodass du sie weiterhin zuweisen kannst.
86 86
87```yuescript 87```yuescript
88do 88do
89 import global 89 import global
90 print "hello" 90 print "hallo"
91 math.random 3 91 math.random 3
92 -- print = nil -- error: imported globals are const 92 -- print = nil -- Fehler: importierte Globals sind const
93 93
94do 94do
95 -- explicit global variable will not be imported 95 -- explizite globale Variable wird nicht importiert
96 import global 96 import global
97 global FLAG 97 global FLAG
98 print FLAG 98 print FLAG
@@ -103,12 +103,12 @@ do
103```yue 103```yue
104do 104do
105 import global 105 import global
106 print "hello" 106 print "hallo"
107 math.random 3 107 math.random 3
108 -- print = nil -- error: imported globals are const 108 -- print = nil -- Fehler: importierte Globals sind const
109 109
110do 110do
111 -- explicit global variable will not be imported 111 -- explizite globale Variable wird nicht importiert
112 import global 112 import global
113 global FLAG 113 global FLAG
114 print FLAG 114 print FLAG
@@ -119,15 +119,15 @@ do
119 119
120## Export 120## Export
121 121
122The export statement offers a concise way to define modules. 122Die `export`-Anweisung bietet eine knappe Möglichkeit, Module zu definieren.
123 123
124### Named Export 124### Benannter Export
125 125
126Named export will define a local variable as well as adding a field in the exported table. 126Benannter Export definiert eine lokale Variable und fügt ein Feld in die exportierte Tabelle ein.
127 127
128```yuescript 128```yuescript
129export a, b, c = 1, 2, 3 129export a, b, c = 1, 2, 3
130export cool = "cat" 130export cool = "Katze"
131 131
132export What = if this 132export What = if this
133 "abc" 133 "abc"
@@ -144,7 +144,7 @@ export class Something
144 144
145```yue 145```yue
146export a, b, c = 1, 2, 3 146export a, b, c = 1, 2, 3
147export cool = "cat" 147export cool = "Katze"
148 148
149export What = if this 149export What = if this
150 "abc" 150 "abc"
@@ -160,7 +160,7 @@ export class Something
160 160
161</YueDisplay> 161</YueDisplay>
162 162
163Doing named export with destructuring. 163Benannter Export mit Destructuring.
164 164
165```yuescript 165```yuescript
166export :loadstring, to_lua: tolua = yue 166export :loadstring, to_lua: tolua = yue
@@ -175,7 +175,7 @@ export {itemA: {:fieldA = 'default'}} = tb
175 175
176</YueDisplay> 176</YueDisplay>
177 177
178Export named items from module without creating local variables. 178Benannte Elemente aus dem Modul exportieren, ohne lokale Variablen zu erstellen.
179 179
180```yuescript 180```yuescript
181export.itemA = tb 181export.itemA = tb
@@ -192,9 +192,9 @@ export["a-b-c"] = 123
192 192
193</YueDisplay> 193</YueDisplay>
194 194
195### Unnamed Export 195### Unbenannter Export
196 196
197Unnamed export will add the target item into the array part of the exported table. 197Unbenannter Export fügt das Ziel-Element in den Array-Teil der exportierten Tabelle ein.
198 198
199```yuescript 199```yuescript
200d, e, f = 3, 2, 1 200d, e, f = 3, 2, 1
@@ -225,20 +225,20 @@ export with tmp
225 225
226</YueDisplay> 226</YueDisplay>
227 227
228### Default Export 228### Default-Export
229 229
230Using the **default** keyword in export statement to replace the exported table with any thing. 230Mit dem Schlüsselwort **default** in einer `export`-Anweisung wird die exportierte Tabelle durch ein beliebiges Objekt ersetzt.
231 231
232```yuescript 232```yuescript
233export default -> 233export default ->
234 print "hello" 234 print "hallo"
235 123 235 123
236``` 236```
237<YueDisplay> 237<YueDisplay>
238 238
239```yue 239```yue
240export default -> 240export default ->
241 print "hello" 241 print "hallo"
242 123 242 123
243``` 243```
244 244
diff --git a/doc/docs/de/doc/advanced/try.md b/doc/docs/de/doc/advanced/try.md
index 23c7877..4550e92 100644
--- a/doc/docs/de/doc/advanced/try.md
+++ b/doc/docs/de/doc/advanced/try.md
@@ -1,6 +1,6 @@
1# Try 1# Try
2 2
3The syntax for Lua error handling in a common form. 3Die Syntax für Fehlerbehandlung in Lua in einer gängigen Form.
4 4
5```yuescript 5```yuescript
6try 6try
@@ -20,10 +20,10 @@ catch err
20success, result = try func 1, 2, 3 20success, result = try func 1, 2, 3
21 21
22try 22try
23 print "trying" 23 print "Versuche"
24 func 1, 2, 3 24 func 1, 2, 3
25 25
26-- working with if assignment pattern 26-- Verwendung mit if-Zuweisungsmuster
27if success, result := try func 1, 2, 3 27if success, result := try func 1, 2, 3
28catch err 28catch err
29 print yue.traceback err 29 print yue.traceback err
@@ -49,10 +49,10 @@ catch err
49success, result = try func 1, 2, 3 49success, result = try func 1, 2, 3
50 50
51try 51try
52 print "trying" 52 print "Versuche"
53 func 1, 2, 3 53 func 1, 2, 3
54 54
55-- working with if assignment pattern 55-- Verwendung mit if-Zuweisungsmuster
56if success, result := try func 1, 2, 3 56if success, result := try func 1, 2, 3
57catch err 57catch err
58 print yue.traceback err 58 print yue.traceback err
@@ -63,18 +63,18 @@ catch err
63 63
64## Try? 64## Try?
65 65
66`try?` is a simplified use for error handling syntax that omit the boolean status from the `try` statement, and it will return the result from the try block when success, return nil instead of error object otherwise. 66`try?` ist eine vereinfachte Fehlerbehandlungs-Syntax, die den booleschen Status aus dem `try`-Statement weglässt. Bei Erfolg gibt sie das Ergebnis des `try`-Blocks zurück, ansonsten `nil` statt eines Fehlerobjekts.
67 67
68```yuescript 68```yuescript
69a, b, c = try? func! 69a, b, c = try? func!
70 70
71-- with nil coalescing operator 71-- mit Nil-Verschmelzungs-Operator
72a = (try? func!) ?? "default" 72a = (try? func!) ?? "Standardwert"
73 73
74-- as function argument 74-- als Funktionsargument
75f try? func! 75f try? func!
76 76
77-- with catch block 77-- mit catch-Block
78f try? 78f try?
79 print 123 79 print 123
80 func! 80 func!
@@ -87,13 +87,13 @@ catch e
87```yue 87```yue
88a, b, c = try? func! 88a, b, c = try? func!
89 89
90-- with nil coalescing operator 90-- mit Nil-Verschmelzungs-Operator
91a = (try? func!) ?? "default" 91a = (try? func!) ?? "Standardwert"
92 92
93-- as function argument 93-- als Funktionsargument
94f try? func! 94f try? func!
95 95
96-- with catch block 96-- mit catch-Block
97f try? 97f try?
98 print 123 98 print 123
99 func! 99 func!
diff --git a/doc/docs/de/doc/assignment/assignment.md b/doc/docs/de/doc/assignment/assignment.md
index 4dac6f4..b74501f 100644
--- a/doc/docs/de/doc/assignment/assignment.md
+++ b/doc/docs/de/doc/assignment/assignment.md
@@ -1,25 +1,26 @@
1# Assignment 1# Zuweisung
2 2
3The variable is dynamic typed and is defined as local by default. But you can change the scope of declaration by **local** and **global** statement. 3Variablen sind dynamisch typisiert und standardmäßig `local`. Du kannst den Geltungsbereich mit den Statements **local** und **global** ändern.
4 4
5```yuescript 5```yuescript
6hello = "world" 6hello = "world"
7a, b, c = 1, 2, 3 7a, b, c = 1, 2, 3
8hello = 123 -- uses the existing variable 8hello = 123 -- nutzt die bestehende Variable
9``` 9```
10<YueDisplay> 10<YueDisplay>
11 11
12```yue 12```yue
13hello = "world" 13hello = "world"
14a, b, c = 1, 2, 3 14a, b, c = 1, 2, 3
15hello = 123 -- uses the existing variable 15hello = 123 -- nutzt die bestehende Variable
16``` 16```
17 17
18</YueDisplay> 18</YueDisplay>
19 19
20## Perform Update 20## Update-Zuweisung
21
22Du kannst Update-Zuweisungen mit vielen binären Operatoren durchführen.
21 23
22You can perform update assignment with many binary operators.
23```yuescript 24```yuescript
24x = 1 25x = 1
25x += 1 26x += 1
@@ -27,7 +28,7 @@ x -= 1
27x *= 10 28x *= 10
28x /= 10 29x /= 10
29x %= 10 30x %= 10
30s ..= "world" -- will add a new local if local variable is not exist 31s ..= "world" -- legt eine neue lokale Variable an, wenn sie nicht existiert
31arg or= "default value" 32arg or= "default value"
32``` 33```
33<YueDisplay> 34<YueDisplay>
@@ -39,15 +40,16 @@ x -= 1
39x *= 10 40x *= 10
40x /= 10 41x /= 10
41x %= 10 42x %= 10
42s ..= "world" -- will add a new local if local variable is not exist 43s ..= "world" -- legt eine neue lokale Variable an, wenn sie nicht existiert
43arg or= "default value" 44arg or= "default value"
44``` 45```
45 46
46</YueDisplay> 47</YueDisplay>
47 48
48## Chaining Assignment 49## Verkettete Zuweisung
50
51Mit verketteten Zuweisungen kannst du mehrere Variablen auf denselben Wert setzen.
49 52
50You can do chaining assignment to assign multiple items to hold the same value.
51```yuescript 53```yuescript
52a = b = c = d = e = 0 54a = b = c = d = e = 0
53x = y = z = f! 55x = y = z = f!
@@ -61,7 +63,8 @@ x = y = z = f!
61 63
62</YueDisplay> 64</YueDisplay>
63 65
64## Explicit Locals 66## Explizite Locals
67
65```yuescript 68```yuescript
66do 69do
67 local a = 1 70 local a = 1
@@ -99,7 +102,8 @@ do
99 102
100</YueDisplay> 103</YueDisplay>
101 104
102## Explicit Globals 105## Explizite Globals
106
103```yuescript 107```yuescript
104do 108do
105 global a = 1 109 global a = 1
diff --git a/doc/docs/de/doc/assignment/destructuring-assignment.md b/doc/docs/de/doc/assignment/destructuring-assignment.md
index e7b8046..0a08e22 100644
--- a/doc/docs/de/doc/assignment/destructuring-assignment.md
+++ b/doc/docs/de/doc/assignment/destructuring-assignment.md
@@ -1,10 +1,10 @@
1# Destructuring Assignment 1# Destructuring-Zuweisung
2 2
3Destructuring assignment is a way to quickly extract values from a table by their name or position in array based tables. 3Destructuring-Zuweisung ist eine Möglichkeit, schnell Werte aus einer Tabelle nach Name oder Position in array-basierten Tabellen zu extrahieren.
4 4
5Typically when you see a table literal, {1,2,3}, it is on the right hand side of an assignment because it is a value. Destructuring assignment swaps the role of the table literal, and puts it on the left hand side of an assign statement. 5Normalerweise steht ein Tabellenliteral wie `{1,2,3}` auf der rechten Seite einer Zuweisung, weil es ein Wert ist. Destructuring-Zuweisung tauscht die Rolle des Tabellenliterals und setzt es auf die linke Seite der Zuweisung.
6 6
7This is best explained with examples. Here is how you would unpack the first two values from a table: 7Am besten lässt sich das mit Beispielen erklären. So entpackst du die ersten zwei Werte einer Tabelle:
8 8
9```yuescript 9```yuescript
10thing = [1, 2] 10thing = [1, 2]
@@ -23,44 +23,44 @@ print a, b
23 23
24</YueDisplay> 24</YueDisplay>
25 25
26In the destructuring table literal, the key represents the key to read from the right hand side, and the value represents the name the read value will be assigned to. 26Im Destructuring-Tabellenliteral repräsentiert der Schlüssel den zu lesenden Schlüssel der rechten Seite, und der Wert ist der Name, dem der gelesene Wert zugewiesen wird.
27 27
28```yuescript 28```yuescript
29obj = { 29obj = {
30 hello: "world" 30 hello: "Welt"
31 day: "tuesday" 31 day: "Dienstag"
32 length: 20 32 length: 20
33} 33}
34 34
35{hello: hello, day: the_day} = obj 35{hello: hello, day: the_day} = obj
36print hello, the_day 36print hello, the_day
37 37
38:day = obj -- OK to do simple destructuring without braces 38:day = obj -- einfache Destructuring-Zuweisung ohne Klammern ist ok
39``` 39```
40<YueDisplay> 40<YueDisplay>
41 41
42```yue 42```yue
43obj = { 43obj = {
44 hello: "world" 44 hello: "Welt"
45 day: "tuesday" 45 day: "Dienstag"
46 length: 20 46 length: 20
47} 47}
48 48
49{hello: hello, day: the_day} = obj 49{hello: hello, day: the_day} = obj
50print hello, the_day 50print hello, the_day
51 51
52:day = obj -- OK to do simple destructuring without braces 52:day = obj -- einfache Destructuring-Zuweisung ohne Klammern ist ok
53``` 53```
54 54
55</YueDisplay> 55</YueDisplay>
56 56
57This also works with nested data structures as well: 57Das funktioniert auch mit verschachtelten Datenstrukturen:
58 58
59```yuescript 59```yuescript
60obj2 = { 60obj2 = {
61 numbers: [1, 2, 3, 4] 61 numbers: [1, 2, 3, 4]
62 properties: { 62 properties: {
63 color: "green" 63 color: "grün"
64 height: 13.5 64 height: 13.5
65 } 65 }
66} 66}
@@ -74,7 +74,7 @@ print first, second, color
74obj2 = { 74obj2 = {
75 numbers: [1, 2, 3, 4] 75 numbers: [1, 2, 3, 4]
76 properties: { 76 properties: {
77 color: "green" 77 color: "grün"
78 height: 13.5 78 height: 13.5
79 } 79 }
80} 80}
@@ -85,7 +85,7 @@ print first, second, color
85 85
86</YueDisplay> 86</YueDisplay>
87 87
88If the destructuring statement is complicated, feel free to spread it out over a few lines. A slightly more complicated example: 88Wenn die Destructuring-Anweisung kompliziert ist, kannst du sie gerne auf mehrere Zeilen verteilen. Ein etwas komplexeres Beispiel:
89 89
90```yuescript 90```yuescript
91{ 91{
@@ -108,7 +108,7 @@ If the destructuring statement is complicated, feel free to spread it out over a
108 108
109</YueDisplay> 109</YueDisplay>
110 110
111It's common to extract values from at table and assign them the local variables that have the same name as the key. In order to avoid repetition we can use the **:** prefix operator: 111Es ist üblich, Werte aus einer Tabelle zu extrahieren und ihnen lokale Variablen mit demselben Namen wie der Schlüssel zuzuweisen. Um Wiederholungen zu vermeiden, kannst du den Präfix-Operator **:** verwenden:
112 112
113```yuescript 113```yuescript
114{:concat, :insert} = table 114{:concat, :insert} = table
@@ -121,7 +121,7 @@ It's common to extract values from at table and assign them the local variables
121 121
122</YueDisplay> 122</YueDisplay>
123 123
124This is effectively the same as import, but we can rename fields we want to extract by mixing the syntax: 124Das ist effektiv dasselbe wie `import`, aber du kannst Felder umbenennen, indem du die Syntax mischst:
125 125
126```yuescript 126```yuescript
127{:mix, :max, random: rand} = math 127{:mix, :max, random: rand} = math
@@ -134,20 +134,20 @@ This is effectively the same as import, but we can rename fields we want to extr
134 134
135</YueDisplay> 135</YueDisplay>
136 136
137You can write default values while doing destructuring like: 137Du kannst Standardwerte beim Destructuring angeben, z. B.:
138 138
139```yuescript 139```yuescript
140{:name = "nameless", :job = "jobless"} = person 140{:name = "namenlos", :job = "arbeitlos"} = person
141``` 141```
142<YueDisplay> 142<YueDisplay>
143 143
144```yue 144```yue
145{:name = "nameless", :job = "jobless"} = person 145{:name = "namenlos", :job = "arbeitlos"} = person
146``` 146```
147 147
148</YueDisplay> 148</YueDisplay>
149 149
150You can use `_` as placeholder when doing a list destructuring: 150Du kannst `_` als Platzhalter verwenden, wenn du eine Listen-Destructuring-Zuweisung machst:
151 151
152```yuescript 152```yuescript
153[_, two, _, four] = items 153[_, two, _, four] = items
@@ -160,64 +160,64 @@ You can use `_` as placeholder when doing a list destructuring:
160 160
161</YueDisplay> 161</YueDisplay>
162 162
163## Range Destructuring 163## Bereichs-Destructuring
164 164
165You can use the spread operator `...` in list destructuring to capture a range of values. This is useful when you want to extract specific elements from the beginning and end of a list while collecting the rest in between. 165Du kannst den Spread-Operator `...` in Listen-Destructuring verwenden, um einen Wertebereich zu erfassen. Das ist nützlich, wenn du bestimmte Elemente am Anfang und Ende einer Liste extrahieren und den Rest dazwischen sammeln willst.
166 166
167```yuescript 167```yuescript
168orders = ["first", "second", "third", "fourth", "last"] 168orders = ["erster", "zweiter", "dritter", "vierter", "letzter"]
169[first, ...bulk, last] = orders 169[first, ...bulk, last] = orders
170print first -- prints: first 170print first -- gibt aus: erster
171print bulk -- prints: {"second", "third", "fourth"} 171print bulk -- gibt aus: {"zweiter", "dritter", "vierter"}
172print last -- prints: last 172print last -- gibt aus: letzter
173``` 173```
174<YueDisplay> 174<YueDisplay>
175 175
176```yue 176```yue
177orders = ["first", "second", "third", "fourth", "last"] 177orders = ["erster", "zweiter", "dritter", "vierter", "letzter"]
178[first, ...bulk, last] = orders 178[first, ...bulk, last] = orders
179print first -- prints: first 179print first -- gibt aus: erster
180print bulk -- prints: {"second", "third", "fourth"} 180print bulk -- gibt aus: {"zweiter", "dritter", "vierter"}
181print last -- prints: last 181print last -- gibt aus: letzter
182``` 182```
183 183
184</YueDisplay> 184</YueDisplay>
185 185
186The spread operator can be used in different positions to capture different ranges, and you can use `_` as a placeholder for the values you don't want to capture: 186Der Spread-Operator kann an unterschiedlichen Positionen verwendet werden, um unterschiedliche Bereiche zu erfassen, und du kannst `_` als Platzhalter für Werte verwenden, die du nicht erfassen willst:
187 187
188```yuescript 188```yuescript
189-- Capture everything after first element 189-- Alles nach dem ersten Element erfassen
190[first, ...rest] = orders 190[first, ...rest] = orders
191 191
192-- Capture everything before last element 192-- Alles vor dem letzten Element erfassen
193[...start, last] = orders 193[...start, last] = orders
194 194
195-- Capture things except the middle elements 195-- Alles außer den mittleren Elementen erfassen
196[first, ..._, last] = orders 196[first, ..._, last] = orders
197``` 197```
198<YueDisplay> 198<YueDisplay>
199 199
200```yue 200```yue
201-- Capture everything after first element 201-- Alles nach dem ersten Element erfassen
202[first, ...rest] = orders 202[first, ...rest] = orders
203 203
204-- Capture everything before last element 204-- Alles vor dem letzten Element erfassen
205[...start, last] = orders 205[...start, last] = orders
206 206
207-- Capture things except the middle elements 207-- Alles außer den mittleren Elementen erfassen
208[first, ..._, last] = orders 208[first, ..._, last] = orders
209``` 209```
210 210
211</YueDisplay> 211</YueDisplay>
212 212
213## Destructuring In Other Places 213## Destructuring an anderen Stellen
214 214
215Destructuring can also show up in places where an assignment implicitly takes place. An example of this is a for loop: 215Destructuring kann auch an Stellen vorkommen, an denen eine Zuweisung implizit erfolgt. Ein Beispiel ist eine `for`-Schleife:
216 216
217```yuescript 217```yuescript
218tuples = [ 218tuples = [
219 ["hello", "world"] 219 ["hallo", "Welt"]
220 ["egg", "head"] 220 ["Ei", "Kopf"]
221] 221]
222 222
223for [left, right] in *tuples 223for [left, right] in *tuples
@@ -227,8 +227,8 @@ for [left, right] in *tuples
227 227
228```yue 228```yue
229tuples = [ 229tuples = [
230 ["hello", "world"] 230 ["hallo", "Welt"]
231 ["egg", "head"] 231 ["Ei", "Kopf"]
232] 232]
233 233
234for [left, right] in *tuples 234for [left, right] in *tuples
@@ -237,4 +237,4 @@ for [left, right] in *tuples
237 237
238</YueDisplay> 238</YueDisplay>
239 239
240We know each element in the array table is a two item tuple, so we can unpack it directly in the names clause of the for statement using a destructure. 240Wir wissen, dass jedes Element der Array-Tabelle ein 2er-Tupel ist, daher können wir es direkt in der Namensliste der `for`-Anweisung mittels Destructuring entpacken.
diff --git a/doc/docs/de/doc/assignment/if-assignment.md b/doc/docs/de/doc/assignment/if-assignment.md
index 02984e8..884a8d2 100644
--- a/doc/docs/de/doc/assignment/if-assignment.md
+++ b/doc/docs/de/doc/assignment/if-assignment.md
@@ -1,6 +1,6 @@
1# If Assignment 1# If-Zuweisung
2 2
3`if` and `elseif` blocks can take an assignment in place of a conditional expression. Upon evaluating the conditional, the assignment will take place and the value that was assigned to will be used as the conditional expression. The assigned variable is only in scope for the body of the conditional, meaning it is never available if the value is not truthy. And you have to use "the walrus operator" `:=` instead of `=` to do assignment. 3`if`- und `elseif`-Blöcke können eine Zuweisung anstelle eines Bedingungsausdrucks enthalten. Beim Auswerten der Bedingung findet die Zuweisung statt, und der zugewiesene Wert wird als Bedingung verwendet. Die zugewiesene Variable ist nur im Geltungsbereich des Bedingungsblocks verfügbar, d. h. sie ist nicht verfügbar, wenn der Wert nicht truthy ist. Für die Zuweisung musst du den "Walrus-Operator" `:=` statt `=` verwenden.
4 4
5```yuescript 5```yuescript
6if user := database.find_user "moon" 6if user := database.find_user "moon"
@@ -17,55 +17,56 @@ if user := database.find_user "moon"
17 17
18```yuescript 18```yuescript
19if hello := os.getenv "hello" 19if hello := os.getenv "hello"
20 print "You have hello", hello 20 print "Du hast hello", hello
21elseif world := os.getenv "world" 21elseif world := os.getenv "world"
22 print "you have world", world 22 print "Du hast world", world
23else 23else
24 print "nothing :(" 24 print "nichts :("
25``` 25```
26<YueDisplay> 26<YueDisplay>
27 27
28```yue 28```yue
29if hello := os.getenv "hello" 29if hello := os.getenv "hello"
30 print "You have hello", hello 30 print "Du hast hello", hello
31elseif world := os.getenv "world" 31elseif world := os.getenv "world"
32 print "you have world", world 32 print "Du hast world", world
33else 33else
34 print "nothing :(" 34 print "nichts :("
35``` 35```
36 36
37</YueDisplay> 37</YueDisplay>
38 38
39If assignment with multiple return values. Only the first value is getting checked, other values are scoped. 39If-Zuweisung mit mehreren Rückgabewerten. Nur der erste Wert wird geprüft, andere Werte bleiben im Scope.
40
40```yuescript 41```yuescript
41if success, result := pcall -> "get result without problems" 42if success, result := pcall -> "Ergebnis ohne Probleme erhalten"
42 print result -- variable result is scoped 43 print result -- Variable result ist im Scope
43print "OK" 44print "OK"
44``` 45```
45<YueDisplay> 46<YueDisplay>
46 47
47```yue 48```yue
48if success, result := pcall -> "get result without problems" 49if success, result := pcall -> "Ergebnis ohne Probleme erhalten"
49 print result -- variable result is scoped 50 print result -- Variable result ist im Scope
50print "OK" 51print "OK"
51``` 52```
52 53
53</YueDisplay> 54</YueDisplay>
54 55
55## While Assignment 56## While-Zuweisung
56 57
57You can also use if assignment in a while loop to get the value as the loop condition. 58Du kannst if-Zuweisung auch in einer while-Schleife verwenden, um den Wert als Schleifenbedingung zu nutzen.
58 59
59```yuescript 60```yuescript
60while byte := stream\read_one! 61while byte := stream\read_one!
61 -- do something with the byte 62 -- mit dem Byte etwas anfangen
62 print byte 63 print byte
63``` 64```
64<YueDisplay> 65<YueDisplay>
65 66
66```yue 67```yue
67while byte := stream\read_one! 68while byte := stream\read_one!
68 -- do something with the byte 69 -- mit dem Byte etwas anfangen
69 print byte 70 print byte
70``` 71```
71 72
diff --git a/doc/docs/de/doc/assignment/the-using-clause-controlling-destructive-assignment.md b/doc/docs/de/doc/assignment/the-using-clause-controlling-destructive-assignment.md
index fb9b740..63bf016 100644
--- a/doc/docs/de/doc/assignment/the-using-clause-controlling-destructive-assignment.md
+++ b/doc/docs/de/doc/assignment/the-using-clause-controlling-destructive-assignment.md
@@ -1,11 +1,11 @@
1# The Using Clause; Controlling Destructive Assignment 1# Die Using-Klausel: Destruktive Zuweisung kontrollieren
2 2
3While lexical scoping can be a great help in reducing the complexity of the code we write, things can get unwieldy as the code size increases. Consider the following snippet: 3Lexikalisches Scoping kann die Komplexität des Codes stark reduzieren, aber mit wachsendem Codeumfang kann es unübersichtlich werden. Betrachte folgendes Beispiel:
4 4
5```yuescript 5```yuescript
6i = 100 6i = 100
7 7
8-- many lines of code... 8-- viele Zeilen Code...
9 9
10my_func = -> 10my_func = ->
11 i = 10 11 i = 10
@@ -15,14 +15,14 @@ my_func = ->
15 15
16my_func! 16my_func!
17 17
18print i -- will print 0 18print i -- wird 0 ausgeben
19``` 19```
20<YueDisplay> 20<YueDisplay>
21 21
22```yue 22```yue
23i = 100 23i = 100
24 24
25-- many lines of code... 25-- viele Zeilen Code...
26 26
27my_func = -> 27my_func = ->
28 i = 10 28 i = 10
@@ -32,25 +32,25 @@ my_func = ->
32 32
33my_func! 33my_func!
34 34
35print i -- will print 0 35print i -- wird 0 ausgeben
36``` 36```
37 37
38</YueDisplay> 38</YueDisplay>
39 39
40In my_func, we've overwritten the value of i mistakenly. In this example it is quite obvious, but consider a large, or foreign code base where it isn't clear what names have already been declared. 40In `my_func` haben wir den Wert von `i` versehentlich überschrieben. In diesem Beispiel ist es offensichtlich, aber in einer großen oder fremden Codebasis ist oft nicht klar, welche Namen bereits deklariert wurden.
41 41
42It would be helpful to say which variables from the enclosing scope we intend on change, in order to prevent us from changing others by accident. 42Es wäre hilfreich, anzugeben, welche Variablen aus dem umschließenden Scope wir verändern wollen, um versehentliche Änderungen zu vermeiden.
43 43
44The using keyword lets us do that. using nil makes sure that no closed variables are overwritten in assignment. The using clause is placed after the argument list in a function, or in place of it if there are no arguments. 44Das Schlüsselwort `using` ermöglicht das. `using nil` stellt sicher, dass keine geschlossenen Variablen bei Zuweisungen überschrieben werden. Die `using`-Klausel steht nach der Argumentliste einer Funktion oder ersetzt sie, wenn es keine Argumente gibt.
45 45
46```yuescript 46```yuescript
47i = 100 47i = 100
48 48
49my_func = (using nil) -> 49my_func = (using nil) ->
50 i = "hello" -- a new local variable is created here 50 i = "hello" -- hier wird eine neue lokale Variable erstellt
51 51
52my_func! 52my_func!
53print i -- prints 100, i is unaffected 53print i -- gibt 100 aus, i bleibt unverändert
54``` 54```
55<YueDisplay> 55<YueDisplay>
56 56
@@ -58,27 +58,27 @@ print i -- prints 100, i is unaffected
58i = 100 58i = 100
59 59
60my_func = (using nil) -> 60my_func = (using nil) ->
61 i = "hello" -- a new local variable is created here 61 i = "hello" -- hier wird eine neue lokale Variable erstellt
62 62
63my_func! 63my_func!
64print i -- prints 100, i is unaffected 64print i -- gibt 100 aus, i bleibt unverändert
65``` 65```
66 66
67</YueDisplay> 67</YueDisplay>
68 68
69Multiple names can be separated by commas. Closure values can still be accessed, they just cant be modified: 69Mehrere Namen können durch Kommas getrennt werden. Closure-Werte nnen weiterhin gelesen, aber nicht verändert werden:
70 70
71```yuescript 71```yuescript
72tmp = 1213 72tmp = 1213
73i, k = 100, 50 73i, k = 100, 50
74 74
75my_func = (add using k, i) -> 75my_func = (add using k, i) ->
76 tmp = tmp + add -- a new local tmp is created 76 tmp = tmp + add -- ein neues lokales tmp wird erstellt
77 i += tmp 77 i += tmp
78 k += tmp 78 k += tmp
79 79
80my_func(22) 80my_func(22)
81print i, k -- these have been updated 81print i, k -- diese wurden aktualisiert
82``` 82```
83<YueDisplay> 83<YueDisplay>
84 84
@@ -87,12 +87,12 @@ tmp = 1213
87i, k = 100, 50 87i, k = 100, 50
88 88
89my_func = (add using k, i) -> 89my_func = (add using k, i) ->
90 tmp = tmp + add -- a new local tmp is created 90 tmp = tmp + add -- ein neues lokales tmp wird erstellt
91 i += tmp 91 i += tmp
92 k += tmp 92 k += tmp
93 93
94my_func(22) 94my_func(22)
95print i, k -- these have been updated 95print i, k -- diese wurden aktualisiert
96``` 96```
97 97
98</YueDisplay> 98</YueDisplay>
diff --git a/doc/docs/de/doc/assignment/varargs-assignment.md b/doc/docs/de/doc/assignment/varargs-assignment.md
index 1d66680..b211a8a 100644
--- a/doc/docs/de/doc/assignment/varargs-assignment.md
+++ b/doc/docs/de/doc/assignment/varargs-assignment.md
@@ -1,6 +1,6 @@
1# Varargs Assignment 1# Varargs-Zuweisung
2 2
3You can assign the results returned from a function to a varargs symbol `...`. And then access its content using the Lua way. 3Du kannst Rückgabewerte einer Funktion dem Varargs-Symbol `...` zuweisen und dann den Inhalt auf die Lua-Weise auslesen.
4 4
5```yuescript 5```yuescript
6list = [1, 2, 3, 4, 5] 6list = [1, 2, 3, 4, 5]
diff --git a/doc/docs/de/doc/control-flow/conditionals.md b/doc/docs/de/doc/control-flow/conditionals.md
index 5ba81cf..d20e6e3 100644
--- a/doc/docs/de/doc/control-flow/conditionals.md
+++ b/doc/docs/de/doc/control-flow/conditionals.md
@@ -1,55 +1,55 @@
1# Conditionals 1# Bedingungen
2 2
3```yuescript 3```yuescript
4have_coins = false 4have_coins = false
5if have_coins 5if have_coins
6 print "Got coins" 6 print "Münzen erhalten"
7else 7else
8 print "No coins" 8 print "Keine Münzen"
9``` 9```
10<YueDisplay> 10<YueDisplay>
11 11
12```yue 12```yue
13have_coins = false 13have_coins = false
14if have_coins 14if have_coins
15 print "Got coins" 15 print "Münzen erhalten"
16else 16else
17 print "No coins" 17 print "Keine Münzen"
18``` 18```
19 19
20</YueDisplay> 20</YueDisplay>
21 21
22A short syntax for single statements can also be used: 22Eine Kurzsyntax für einzelne Anweisungen kann ebenfalls verwendet werden:
23 23
24```yuescript 24```yuescript
25have_coins = false 25have_coins = false
26if have_coins then print "Got coins" else print "No coins" 26if have_coins then print "Münzen erhalten" else print "Keine Münzen"
27``` 27```
28<YueDisplay> 28<YueDisplay>
29 29
30```yue 30```yue
31have_coins = false 31have_coins = false
32if have_coins then print "Got coins" else print "No coins" 32if have_coins then print "Münzen erhalten" else print "Keine Münzen"
33``` 33```
34 34
35</YueDisplay> 35</YueDisplay>
36 36
37Because if statements can be used as expressions, this can also be written as: 37Da `if`-Anweisungen als Ausdrücke verwendet werden können, kann man das auch so schreiben:
38 38
39```yuescript 39```yuescript
40have_coins = false 40have_coins = false
41print if have_coins then "Got coins" else "No coins" 41print if have_coins then "Münzen erhalten" else "Keine Münzen"
42``` 42```
43<YueDisplay> 43<YueDisplay>
44 44
45```yue 45```yue
46have_coins = false 46have_coins = false
47print if have_coins then "Got coins" else "No coins" 47print if have_coins then "Münzen erhalten" else "Keine Münzen"
48``` 48```
49 49
50</YueDisplay> 50</YueDisplay>
51 51
52Conditionals can also be used in return statements and assignments: 52Bedingungen können auch in `return`-Anweisungen und Zuweisungen verwendet werden:
53 53
54```yuescript 54```yuescript
55is_tall = (name) -> 55is_tall = (name) ->
@@ -59,11 +59,11 @@ is_tall = (name) ->
59 false 59 false
60 60
61message = if is_tall "Rob" 61message = if is_tall "Rob"
62 "I am very tall" 62 "Ich bin sehr groß"
63else 63else
64 "I am not so tall" 64 "Ich bin nicht so groß"
65 65
66print message -- prints: I am very tall 66print message -- gibt aus: Ich bin sehr groß
67``` 67```
68<YueDisplay> 68<YueDisplay>
69 69
@@ -75,26 +75,26 @@ is_tall = (name) ->
75 false 75 false
76 76
77message = if is_tall "Rob" 77message = if is_tall "Rob"
78 "I am very tall" 78 "Ich bin sehr groß"
79else 79else
80 "I am not so tall" 80 "Ich bin nicht so groß"
81 81
82print message -- prints: I am very tall 82print message -- gibt aus: Ich bin sehr groß
83``` 83```
84 84
85</YueDisplay> 85</YueDisplay>
86 86
87The opposite of if is unless: 87Das Gegenteil von `if` ist `unless`:
88 88
89```yuescript 89```yuescript
90unless os.date("%A") == "Monday" 90unless os.date("%A") == "Monday"
91 print "it is not Monday!" 91 print "Es ist nicht Montag!"
92``` 92```
93<YueDisplay> 93<YueDisplay>
94 94
95```yue 95```yue
96unless os.date("%A") == "Monday" 96unless os.date("%A") == "Monday"
97 print "it is not Monday!" 97 print "Es ist nicht Montag!"
98``` 98```
99 99
100</YueDisplay> 100</YueDisplay>
@@ -110,18 +110,18 @@ print "You're lucky!" unless math.random! > 0.1
110 110
111</YueDisplay> 111</YueDisplay>
112 112
113## In Expression 113## In-Ausdruck
114 114
115You can write range checking code with an `in-expression`. 115Mit einem `in`-Ausdruck kannst du Bereichsprüfungen schreiben.
116 116
117```yuescript 117```yuescript
118a = 5 118a = 5
119 119
120if a in [1, 3, 5, 7] 120if a in [1, 3, 5, 7]
121 print "checking equality with discrete values" 121 print "Gleichheitsprüfung mit diskreten Werten"
122 122
123if a in list 123if a in list
124 print "checking if `a` is in a list" 124 print "Prüfen, ob `a` in einer Liste ist"
125``` 125```
126<YueDisplay> 126<YueDisplay>
127 127
@@ -129,21 +129,10 @@ if a in list
129a = 5 129a = 5
130 130
131if a in [1, 3, 5, 7] 131if a in [1, 3, 5, 7]
132 print "checking equality with discrete values" 132 print "Gleichheitsprüfung mit diskreten Werten"
133 133
134if a in list 134if a in list
135 print "checking if `a` is in a list" 135 print "Prüfen, ob `a` in einer Liste ist"
136```
137
138</YueDisplay>
139
140```yuescript
141print "You're lucky!" unless math.random! > 0.1
142```
143<YueDisplay>
144
145```yue
146print "You're lucky!" unless math.random! > 0.1
147``` 136```
148 137
149</YueDisplay> 138</YueDisplay>
diff --git a/doc/docs/de/doc/control-flow/continue.md b/doc/docs/de/doc/control-flow/continue.md
index b000765..a6210d4 100644
--- a/doc/docs/de/doc/control-flow/continue.md
+++ b/doc/docs/de/doc/control-flow/continue.md
@@ -1,6 +1,6 @@
1# Continue 1# Continue
2 2
3A continue statement can be used to skip the current iteration in a loop. 3Eine `continue`-Anweisung überspringt die aktuelle Iteration einer Schleife.
4 4
5```yuescript 5```yuescript
6i = 0 6i = 0
@@ -21,7 +21,7 @@ while i < 10
21 21
22</YueDisplay> 22</YueDisplay>
23 23
24continue can also be used with loop expressions to prevent that iteration from accumulating into the result. This examples filters the array table into just even numbers: 24`continue` kann auch mit Schleifenausdrücken verwendet werden, um zu verhindern, dass diese Iteration in das Ergebnis akkumuliert wird. Dieses Beispiel filtert die Array-Tabelle auf gerade Zahlen:
25 25
26```yuescript 26```yuescript
27my_numbers = [1, 2, 3, 4, 5, 6] 27my_numbers = [1, 2, 3, 4, 5, 6]
diff --git a/doc/docs/de/doc/control-flow/for-loop.md b/doc/docs/de/doc/control-flow/for-loop.md
index cabcde5..3bf63d4 100644
--- a/doc/docs/de/doc/control-flow/for-loop.md
+++ b/doc/docs/de/doc/control-flow/for-loop.md
@@ -1,12 +1,12 @@
1# For Loop 1# For-Schleife
2 2
3There are two for loop forms, just like in Lua. A numeric one and a generic one: 3Es gibt zwei Formen der `for`-Schleife, genau wie in Lua: eine numerische und eine generische.
4 4
5```yuescript 5```yuescript
6for i = 10, 20 6for i = 10, 20
7 print i 7 print i
8 8
9for k = 1, 15, 2 -- an optional step provided 9for k = 1, 15, 2 -- ein optionaler Schritt
10 print k 10 print k
11 11
12for key, value in pairs object 12for key, value in pairs object
@@ -18,7 +18,7 @@ for key, value in pairs object
18for i = 10, 20 18for i = 10, 20
19 print i 19 print i
20 20
21for k = 1, 15, 2 -- an optional step provided 21for k = 1, 15, 2 -- ein optionaler Schritt
22 print k 22 print k
23 23
24for key, value in pairs object 24for key, value in pairs object
@@ -27,7 +27,7 @@ for key, value in pairs object
27 27
28</YueDisplay> 28</YueDisplay>
29 29
30The slicing and **\*** operators can be used, just like with comprehensions: 30Die Slicing- und **\***-Operatoren nnen verwendet werden, genau wie bei Comprehensions:
31 31
32```yuescript 32```yuescript
33for item in *items[2, 4] 33for item in *items[2, 4]
@@ -42,7 +42,7 @@ for item in *items[2, 4]
42 42
43</YueDisplay> 43</YueDisplay>
44 44
45A shorter syntax is also available for all variations when the body is only a single line: 45Eine rzere Syntax ist für alle Varianten verfügbar, wenn der Rumpf nur eine Zeile hat:
46 46
47```yuescript 47```yuescript
48for item in *items do print item 48for item in *items do print item
@@ -59,9 +59,9 @@ for j = 1, 10, 3 do print j
59 59
60</YueDisplay> 60</YueDisplay>
61 61
62A for loop can also be used as an expression. The last statement in the body of the for loop is coerced into an expression and appended to an accumulating array table. 62Eine `for`-Schleife kann auch als Ausdruck verwendet werden. Die letzte Anweisung im Schleifenrumpf wird in einen Ausdruck umgewandelt und an eine wachsende Array-Tabelle angehängt.
63 63
64Doubling every even number: 64Alle geraden Zahlen verdoppeln:
65 65
66```yuescript 66```yuescript
67doubled_evens = for i = 1, 20 67doubled_evens = for i = 1, 20
@@ -82,9 +82,9 @@ doubled_evens = for i = 1, 20
82 82
83</YueDisplay> 83</YueDisplay>
84 84
85In addition, for loops support break with a return value, allowing the loop itself to be used as an expression that exits early with a meaningful result. 85Zusätzlich unterstützen `for`-Schleifen `break` mit Rückgabewert, sodass die Schleife selbst als Ausdruck verwendet werden kann, der früh mit einem sinnvollen Ergebnis endet.
86 86
87For example, to find the first number greater than 10: 87Beispiel: die erste Zahl größer als 10 finden:
88 88
89```yuescript 89```yuescript
90first_large = for n in *numbers 90first_large = for n in *numbers
@@ -99,18 +99,18 @@ first_large = for n in *numbers
99 99
100</YueDisplay> 100</YueDisplay>
101 101
102This break-with-value syntax enables concise and expressive search or early-exit patterns directly within loop expressions. 102Diese `break`-mit-Wert-Syntax ermöglicht knappe und ausdrucksstarke Such- bzw. Early-Exit-Muster direkt in Schleifenausdrücken.
103 103
104You can also filter values by combining the for loop expression with the continue statement. 104Du kannst Werte auch filtern, indem du den `for`-Ausdruck mit `continue` kombinierst.
105 105
106For loops at the end of a function body are not accumulated into a table for a return value (Instead the function will return nil). Either an explicit return statement can be used, or the loop can be converted into a list comprehension. 106`for`-Schleifen am Ende eines Funktionsrumpfs werden nicht in eine Tabelle für einen Rückgabewert gesammelt (stattdessen gibt die Funktion `nil` zurück). Du kannst entweder explizit `return` verwenden oder die Schleife in eine Listen-Comprehension umwandeln.
107 107
108```yuescript 108```yuescript
109func_a = -> for i = 1, 10 do print i 109func_a = -> for i = 1, 10 do print i
110func_b = -> return for i = 1, 10 do i 110func_b = -> return for i = 1, 10 do i
111 111
112print func_a! -- prints nil 112print func_a! -- gibt nil aus
113print func_b! -- prints table object 113print func_b! -- gibt Tabellenobjekt aus
114``` 114```
115<YueDisplay> 115<YueDisplay>
116 116
@@ -118,10 +118,10 @@ print func_b! -- prints table object
118func_a = -> for i = 1, 10 do print i 118func_a = -> for i = 1, 10 do print i
119func_b = -> return for i = 1, 10 do i 119func_b = -> return for i = 1, 10 do i
120 120
121print func_a! -- prints nil 121print func_a! -- gibt nil aus
122print func_b! -- prints table object 122print func_b! -- gibt Tabellenobjekt aus
123``` 123```
124 124
125</YueDisplay> 125</YueDisplay>
126 126
127This is done to avoid the needless creation of tables for functions that don't need to return the results of the loop. 127Das verhindert die unnötige Erstellung von Tabellen in Funktionen, die die Ergebnisse der Schleife nicht zurückgeben müssen.
diff --git a/doc/docs/de/doc/control-flow/switch.md b/doc/docs/de/doc/control-flow/switch.md
index f503a80..81e08bd 100644
--- a/doc/docs/de/doc/control-flow/switch.md
+++ b/doc/docs/de/doc/control-flow/switch.md
@@ -1,33 +1,33 @@
1# Switch 1# Switch
2 2
3The switch statement is shorthand for writing a series of if statements that check against the same value. Note that the value is only evaluated once. Like if statements, switches can have an else block to handle no matches. Comparison is done with the == operator. In switch statement, you can also use assignment expression to store temporary variable value. 3Die `switch`-Anweisung ist eine Kurzform für eine Reihe von `if`-Anweisungen, die gegen denselben Wert prüfen. Der Wert wird nur einmal ausgewertet. Wie bei `if` kann `switch` einen `else`-Block haben, wenn keine Übereinstimmung gefunden wird. Verglichen wird mit dem Operator `==`. In einer `switch`-Anweisung kannst du auch eine Zuweisung verwenden, um den temporären Wert zu speichern.
4 4
5```yuescript 5```yuescript
6switch name := "Dan" 6switch name := "Dan"
7 when "Robert" 7 when "Robert"
8 print "You are Robert" 8 print "Du bist Robert"
9 when "Dan", "Daniel" 9 when "Dan", "Daniel"
10 print "Your name, it's Dan" 10 print "Dein Name ist Dan"
11 else 11 else
12 print "I don't know about you with name #{name}" 12 print "Ich kenne dich nicht mit dem Namen #{name}"
13``` 13```
14<YueDisplay> 14<YueDisplay>
15 15
16```yue 16```yue
17switch name := "Dan" 17switch name := "Dan"
18 when "Robert" 18 when "Robert"
19 print "You are Robert" 19 print "Du bist Robert"
20 when "Dan", "Daniel" 20 when "Dan", "Daniel"
21 print "Your name, it's Dan" 21 print "Dein Name ist Dan"
22 else 22 else
23 print "I don't know about you with name #{name}" 23 print "Ich kenne dich nicht mit dem Namen #{name}"
24``` 24```
25 25
26</YueDisplay> 26</YueDisplay>
27 27
28A switch when clause can match against multiple values by listing them out comma separated. 28Eine `when`-Klausel kann mehrere Werte prüfen, indem sie kommasepariert aufgelistet werden.
29 29
30Switches can be used as expressions as well, here we can assign the result of the switch to a variable: 30`switch` kann auch als Ausdruck verwendet werden. Hier wird das Ergebnis der `switch`-Anweisung einer Variable zugewiesen:
31 31
32```yuescript 32```yuescript
33b = 1 33b = 1
@@ -37,7 +37,7 @@ next_number = switch b
37 when 2 37 when 2
38 3 38 3
39 else 39 else
40 error "can't count that high!" 40 error "so hoch kann ich nicht hlen!"
41``` 41```
42<YueDisplay> 42<YueDisplay>
43 43
@@ -49,66 +49,66 @@ next_number = switch b
49 when 2 49 when 2
50 3 50 3
51 else 51 else
52 error "can't count that high!" 52 error "so hoch kann ich nicht hlen!"
53``` 53```
54 54
55</YueDisplay> 55</YueDisplay>
56 56
57We can use the then keyword to write a switch's when block on a single line. No extra keyword is needed to write the else block on a single line. 57Du kannst das Schlüsselwort `then` verwenden, um einen `when`-Block in einer Zeile zu schreiben. Für den `else`-Block braucht es kein zusätzliches Schlüsselwort.
58 58
59```yuescript 59```yuescript
60msg = switch math.random(1, 5) 60msg = switch math.random(1, 5)
61 when 1 then "you are lucky" 61 when 1 then "Du hast Glück"
62 when 2 then "you are almost lucky" 62 when 2 then "Du hast fast Glück"
63 else "not so lucky" 63 else "nicht so viel Glück"
64``` 64```
65<YueDisplay> 65<YueDisplay>
66 66
67```yue 67```yue
68msg = switch math.random(1, 5) 68msg = switch math.random(1, 5)
69 when 1 then "you are lucky" 69 when 1 then "Du hast Glück"
70 when 2 then "you are almost lucky" 70 when 2 then "Du hast fast Glück"
71 else "not so lucky" 71 else "nicht so viel Glück"
72``` 72```
73 73
74</YueDisplay> 74</YueDisplay>
75 75
76If you want to write code with one less indent when writing a switch statement, you can put the first when clause on the statement start line, and then all other clauses can be written with one less indent. 76Wenn du eine Einrückung weniger möchtest, kannst du die erste `when`-Klausel in die Startzeile der Anweisung setzen und alle weiteren Klauseln mit einer Einrückung weniger schreiben.
77 77
78```yuescript 78```yuescript
79switch math.random(1, 5) 79switch math.random(1, 5)
80 when 1 80 when 1
81 print "you are lucky" -- two indents 81 print "Du hast Glück" -- zwei Einrückungen
82 else 82 else
83 print "not so lucky" 83 print "nicht so viel Glück"
84 84
85switch math.random(1, 5) when 1 85switch math.random(1, 5) when 1
86 print "you are lucky" -- one indent 86 print "Du hast Glück" -- eine Einrückung
87else 87else
88 print "not so lucky" 88 print "nicht so viel Glück"
89``` 89```
90<YueDisplay> 90<YueDisplay>
91 91
92```yue 92```yue
93switch math.random(1, 5) 93switch math.random(1, 5)
94 when 1 94 when 1
95 print "you are lucky" -- two indents 95 print "Du hast Glück" -- zwei Einrückungen
96 else 96 else
97 print "not so lucky" 97 print "nicht so viel Glück"
98 98
99switch math.random(1, 5) when 1 99switch math.random(1, 5) when 1
100 print "you are lucky" -- one indent 100 print "Du hast Glück" -- eine Einrückung
101else 101else
102 print "not so lucky" 102 print "nicht so viel Glück"
103``` 103```
104 104
105</YueDisplay> 105</YueDisplay>
106 106
107It is worth noting the order of the case comparison expression. The case's expression is on the left hand side. This can be useful if the case's expression wants to overwrite how the comparison is done by defining an eq metamethod. 107Beachte die Reihenfolge des Case-Vergleichsausdrucks. Der Case-Ausdruck steht auf der linken Seite. Das kann nützlich sein, wenn der Case-Ausdruck die Vergleichslogik über eine `__eq`-Metamethod selbst definiert.
108 108
109## Table Matching 109## Tabellen-Matching
110 110
111You can do table matching in a switch when clause, if the table can be destructured by a specific structure and get non-nil values. 111Du kannst in einer `switch`-`when`-Klausel Tabellen-Matching verwenden, wenn die Tabelle durch eine bestimmte Struktur destrukturiert werden kann und dabei nicht-`nil`-Werte liefert.
112 112
113```yuescript 113```yuescript
114items = 114items =
@@ -122,7 +122,7 @@ for item in *items
122 when :x, :y 122 when :x, :y
123 print "Vec2 #{x}, #{y}" 123 print "Vec2 #{x}, #{y}"
124 when :width, :height 124 when :width, :height
125 print "size #{width}, #{height}" 125 print "Größe #{width}, #{height}"
126``` 126```
127<YueDisplay> 127<YueDisplay>
128 128
@@ -138,39 +138,39 @@ for item in *items
138 when :x, :y 138 when :x, :y
139 print "Vec2 #{x}, #{y}" 139 print "Vec2 #{x}, #{y}"
140 when :width, :height 140 when :width, :height
141 print "size #{width}, #{height}" 141 print "Größe #{width}, #{height}"
142``` 142```
143 143
144</YueDisplay> 144</YueDisplay>
145 145
146You can use default values to optionally destructure the table for some fields. 146Du kannst Standardwerte verwenden, um bestimmte Felder optional zu destrukturieren.
147 147
148```yuescript 148```yuescript
149item = {} 149item = {}
150 150
151{pos: {:x = 50, :y = 200}} = item -- get error: attempt to index a nil value (field 'pos') 151{pos: {:x = 50, :y = 200}} = item -- Fehler: Versuch, einen nil-Wert zu indexieren (Feld 'pos')
152 152
153switch item 153switch item
154 when {pos: {:x = 50, :y = 200}} 154 when {pos: {:x = 50, :y = 200}}
155 print "Vec2 #{x}, #{y}" -- table destructuring will still pass 155 print "Vec2 #{x}, #{y}" -- Tabellen-Destrukturierung greift trotzdem
156``` 156```
157<YueDisplay> 157<YueDisplay>
158 158
159```yue 159```yue
160item = {} 160item = {}
161 161
162{pos: {:x = 50, :y = 200}} = item -- get error: attempt to index a nil value (field 'pos') 162{pos: {:x = 50, :y = 200}} = item -- Fehler: Versuch, einen nil-Wert zu indexieren (Feld 'pos')
163 163
164switch item 164switch item
165 when {pos: {:x = 50, :y = 200}} 165 when {pos: {:x = 50, :y = 200}}
166 print "Vec2 #{x}, #{y}" -- table destructuring will still pass 166 print "Vec2 #{x}, #{y}" -- Tabellen-Destrukturierung greift trotzdem
167``` 167```
168 168
169</YueDisplay> 169</YueDisplay>
170 170
171You can also match against array elements, table fields, and even nested structures with array or table literals. 171Du kannst auch gegen Array-Elemente, Tabellenfelder und sogar verschachtelte Strukturen mit Array- oder Tabellenliteralen matchen.
172 172
173Match against array elements. 173Matchen gegen Array-Elemente.
174 174
175```yuescript 175```yuescript
176switch tb 176switch tb
@@ -178,7 +178,7 @@ switch tb
178 print "1, 2, 3" 178 print "1, 2, 3"
179 when [1, b, 3] 179 when [1, b, 3]
180 print "1, #{b}, 3" 180 print "1, #{b}, 3"
181 when [1, 2, b = 3] -- b has a default value 181 when [1, 2, b = 3] -- b hat einen Standardwert
182 print "1, 2, #{b}" 182 print "1, 2, #{b}"
183``` 183```
184<YueDisplay> 184<YueDisplay>
@@ -189,63 +189,63 @@ switch tb
189 print "1, 2, 3" 189 print "1, 2, 3"
190 when [1, b, 3] 190 when [1, b, 3]
191 print "1, #{b}, 3" 191 print "1, #{b}, 3"
192 when [1, 2, b = 3] -- b has a default value 192 when [1, 2, b = 3] -- b hat einen Standardwert
193 print "1, 2, #{b}" 193 print "1, 2, #{b}"
194``` 194```
195 195
196</YueDisplay> 196</YueDisplay>
197 197
198Match against table fields with destructuring. 198Matchen gegen Tabellenfelder mit Destructuring.
199 199
200```yuescript 200```yuescript
201switch tb 201switch tb
202 when success: true, :result 202 when success: true, :result
203 print "success", result 203 print "Erfolg", result
204 when success: false 204 when success: false
205 print "failed", result 205 print "fehlgeschlagen", result
206 else 206 else
207 print "invalid" 207 print "unltig"
208``` 208```
209<YueDisplay> 209<YueDisplay>
210 210
211```yue 211```yue
212switch tb 212switch tb
213 when success: true, :result 213 when success: true, :result
214 print "success", result 214 print "Erfolg", result
215 when success: false 215 when success: false
216 print "failed", result 216 print "fehlgeschlagen", result
217 else 217 else
218 print "invalid" 218 print "unltig"
219``` 219```
220 220
221</YueDisplay> 221</YueDisplay>
222 222
223Match against nested table structures. 223Matchen gegen verschachtelte Tabellenstrukturen.
224 224
225```yuescript 225```yuescript
226switch tb 226switch tb
227 when data: {type: "success", :content} 227 when data: {type: "success", :content}
228 print "success", content 228 print "Erfolg", content
229 when data: {type: "error", :content} 229 when data: {type: "error", :content}
230 print "failed", content 230 print "fehlgeschlagen", content
231 else 231 else
232 print "invalid" 232 print "unltig"
233``` 233```
234<YueDisplay> 234<YueDisplay>
235 235
236```yue 236```yue
237switch tb 237switch tb
238 when data: {type: "success", :content} 238 when data: {type: "success", :content}
239 print "success", content 239 print "Erfolg", content
240 when data: {type: "error", :content} 240 when data: {type: "error", :content}
241 print "failed", content 241 print "fehlgeschlagen", content
242 else 242 else
243 print "invalid" 243 print "unltig"
244``` 244```
245 245
246</YueDisplay> 246</YueDisplay>
247 247
248Match against array of tables. 248Matchen gegen Array von Tabellen.
249 249
250```yuescript 250```yuescript
251switch tb 251switch tb
@@ -255,7 +255,7 @@ switch tb
255 {a: 5, b: 6} 255 {a: 5, b: 6}
256 fourth 256 fourth
257 ] 257 ]
258 print "matched", fourth 258 print "getroffen", fourth
259``` 259```
260<YueDisplay> 260<YueDisplay>
261 261
@@ -267,20 +267,20 @@ switch tb
267 {a: 5, b: 6} 267 {a: 5, b: 6}
268 fourth 268 fourth
269 ] 269 ]
270 print "matched", fourth 270 print "getroffen", fourth
271``` 271```
272 272
273</YueDisplay> 273</YueDisplay>
274 274
275Match against a list and capture a range of elements. 275Matchen gegen eine Liste und einen Bereich von Elementen erfassen.
276 276
277```yuescript 277```yuescript
278segments = ["admin", "users", "logs", "view"] 278segments = ["admin", "users", "logs", "view"]
279switch segments 279switch segments
280 when [...groups, resource, action] 280 when [...groups, resource, action]
281 print "Group:", groups -- prints: {"admin", "users"} 281 print "Gruppe:", groups -- gibt aus: {"admin", "users"}
282 print "Resource:", resource -- prints: "logs" 282 print "Ressource:", resource -- gibt aus: "logs"
283 print "Action:", action -- prints: "view" 283 print "Aktion:", action -- gibt aus: "view"
284``` 284```
285<YueDisplay> 285<YueDisplay>
286 286
@@ -288,9 +288,9 @@ switch segments
288segments = ["admin", "users", "logs", "view"] 288segments = ["admin", "users", "logs", "view"]
289switch segments 289switch segments
290 when [...groups, resource, action] 290 when [...groups, resource, action]
291 print "Group:", groups -- prints: {"admin", "users"} 291 print "Gruppe:", groups -- gibt aus: {"admin", "users"}
292 print "Resource:", resource -- prints: "logs" 292 print "Ressource:", resource -- gibt aus: "logs"
293 print "Action:", action -- prints: "view" 293 print "Aktion:", action -- gibt aus: "view"
294``` 294```
295 295
296</YueDisplay> 296</YueDisplay>
diff --git a/doc/docs/de/doc/control-flow/while-loop.md b/doc/docs/de/doc/control-flow/while-loop.md
index 502935e..a875bf9 100644
--- a/doc/docs/de/doc/control-flow/while-loop.md
+++ b/doc/docs/de/doc/control-flow/while-loop.md
@@ -1,6 +1,6 @@
1# While Loop 1# While-Schleife
2 2
3The while loop also comes in four variations: 3Die `while`-Schleife gibt es ebenfalls in vier Variationen:
4 4
5```yuescript 5```yuescript
6i = 10 6i = 10
@@ -43,11 +43,11 @@ until running == false do my_function!
43 43
44</YueDisplay> 44</YueDisplay>
45 45
46Like for loops, the while loop can also be used an expression. Additionally, for a function to return the accumulated value of a while loop, the statement must be explicitly returned. 46Wie bei `for`-Schleifen kann die `while`-Schleife auch als Ausdruck verwendet werden. Damit eine Funktion den akkumulierten Wert einer `while`-Schleife zurückgibt, muss die Anweisung explizit mit `return` zurückgegeben werden.
47 47
48## Repeat Loop 48## Repeat-Schleife
49 49
50The repeat loop comes from Lua: 50Die `repeat`-Schleife stammt aus Lua:
51 51
52```yuescript 52```yuescript
53i = 10 53i = 10
diff --git a/doc/docs/de/doc/data-structures/comprehensions.md b/doc/docs/de/doc/data-structures/comprehensions.md
index 3a92167..7e00c57 100644
--- a/doc/docs/de/doc/data-structures/comprehensions.md
+++ b/doc/docs/de/doc/data-structures/comprehensions.md
@@ -1,10 +1,10 @@
1# Comprehensions 1# Comprehensions
2 2
3Comprehensions provide a convenient syntax for constructing a new table by iterating over some existing object and applying an expression to its values. There are two kinds of comprehensions: list comprehensions and table comprehensions. They both produce Lua tables; list comprehensions accumulate values into an array-like table, and table comprehensions let you set both the key and the value on each iteration. 3Comprehensions bieten eine bequeme Syntax, um eine neue Tabelle zu erzeugen, indem man über ein bestehendes Objekt iteriert und einen Ausdruck auf seine Werte anwendet. Es gibt zwei Arten: Listen-Comprehensions und Tabellen-Comprehensions. Beide erzeugen Lua-Tabellen; Listen-Comprehensions sammeln Werte in einer array-ähnlichen Tabelle, und Tabellen-Comprehensions erlauben es, Schlüssel und Wert pro Iteration zu setzen.
4 4
5## List Comprehensions 5## Listen-Comprehensions
6 6
7The following creates a copy of the items table but with all the values doubled. 7Das folgende Beispiel erstellt eine Kopie der `items`-Tabelle, aber mit verdoppelten Werten.
8 8
9```yuescript 9```yuescript
10items = [ 1, 2, 3, 4 ] 10items = [ 1, 2, 3, 4 ]
@@ -19,7 +19,7 @@ doubled = [item * 2 for i, item in ipairs items]
19 19
20</YueDisplay> 20</YueDisplay>
21 21
22The items included in the new table can be restricted with a when clause: 22Die Elemente in der neuen Tabelle nnen mit einer `when`-Klausel eingeschränkt werden:
23 23
24```yuescript 24```yuescript
25slice = [item for i, item in ipairs items when i > 1 and i < 3] 25slice = [item for i, item in ipairs items when i > 1 and i < 3]
@@ -32,7 +32,7 @@ slice = [item for i, item in ipairs items when i > 1 and i < 3]
32 32
33</YueDisplay> 33</YueDisplay>
34 34
35Because it is common to iterate over the values of a numerically indexed table, an **\*** operator is introduced. The doubled example can be rewritten as: 35Da es üblich ist, über die Werte einer numerisch indizierten Tabelle zu iterieren, gibt es den **\***-Operator. Das Verdopplungsbeispiel kann so umgeschrieben werden:
36 36
37```yuescript 37```yuescript
38doubled = [item * 2 for item in *items] 38doubled = [item * 2 for item in *items]
@@ -45,7 +45,7 @@ doubled = [item * 2 for item in *items]
45 45
46</YueDisplay> 46</YueDisplay>
47 47
48In list comprehensions, you can also use the spread operator `...` to flatten nested lists, achieving a flat map effect: 48In Listen-Comprehensions kannst du außerdem den Spread-Operator `...` verwenden, um verschachtelte Listen zu flatten und einen Flat-Map-Effekt zu erzielen:
49 49
50```yuescript 50```yuescript
51data = 51data =
@@ -53,7 +53,7 @@ data =
53 b: [4, 5, 6] 53 b: [4, 5, 6]
54 54
55flat = [...v for k,v in pairs data] 55flat = [...v for k,v in pairs data]
56-- flat is now [1, 2, 3, 4, 5, 6] 56-- flat ist jetzt [1, 2, 3, 4, 5, 6]
57``` 57```
58<YueDisplay> 58<YueDisplay>
59 59
@@ -63,14 +63,14 @@ data =
63 b: [4, 5, 6] 63 b: [4, 5, 6]
64 64
65flat = [...v for k,v in pairs data] 65flat = [...v for k,v in pairs data]
66-- flat is now [1, 2, 3, 4, 5, 6] 66-- flat ist jetzt [1, 2, 3, 4, 5, 6]
67``` 67```
68 68
69</YueDisplay> 69</YueDisplay>
70 70
71The for and when clauses can be chained as much as desired. The only requirement is that a comprehension has at least one for clause. 71Die `for`- und `when`-Klauseln können beliebig oft verkettet werden. Die einzige Anforderung ist, dass eine Comprehension mindestens eine `for`-Klausel enthält.
72 72
73Using multiple for clauses is the same as using nested loops: 73Mehrere `for`-Klauseln entsprechen verschachtelten Schleifen:
74 74
75```yuescript 75```yuescript
76x_coords = [4, 5, 6, 7] 76x_coords = [4, 5, 6, 7]
@@ -91,7 +91,7 @@ for y in *y_coords]
91 91
92</YueDisplay> 92</YueDisplay>
93 93
94Numeric for loops can also be used in comprehensions: 94Numerische `for`-Schleifen können ebenfalls in Comprehensions verwendet werden:
95 95
96```yuescript 96```yuescript
97evens = [i for i = 1, 100 when i % 2 == 0] 97evens = [i for i = 1, 100 when i % 2 == 0]
@@ -104,16 +104,16 @@ evens = [i for i = 1, 100 when i % 2 == 0]
104 104
105</YueDisplay> 105</YueDisplay>
106 106
107## Table Comprehensions 107## Tabellen-Comprehensions
108 108
109The syntax for table comprehensions is very similar, only differing by using **{** and **}** and taking two values from each iteration. 109Die Syntax für Tabellen-Comprehensions ist sehr ähnlich, unterscheidet sich jedoch dadurch, dass **{** und **}** verwendet werden und pro Iteration zwei Werte erzeugt werden.
110 110
111This example makes a copy of the tablething: 111Dieses Beispiel erstellt eine Kopie von `thing`:
112 112
113```yuescript 113```yuescript
114thing = { 114thing = {
115 color: "red" 115 color: "rot"
116 name: "fast" 116 name: "schnell"
117 width: 123 117 width: 123
118} 118}
119 119
@@ -123,8 +123,8 @@ thing_copy = {k, v for k, v in pairs thing}
123 123
124```yue 124```yue
125thing = { 125thing = {
126 color: "red" 126 color: "rot"
127 name: "fast" 127 name: "schnell"
128 width: 123 128 width: 123
129} 129}
130 130
@@ -144,7 +144,7 @@ no_color = {k, v for k, v in pairs thing when k != "color"}
144 144
145</YueDisplay> 145</YueDisplay>
146 146
147The **\*** operator is also supported. Here we create a square root look up table for a few numbers. 147Der **\***-Operator wird ebenfalls unterstützt. Hier erstellen wir eine Nachschlagetabelle für Quadratwurzeln einiger Zahlen.
148 148
149```yuescript 149```yuescript
150numbers = [1, 2, 3, 4] 150numbers = [1, 2, 3, 4]
@@ -159,18 +159,18 @@ sqrts = {i, math.sqrt i for i in *numbers}
159 159
160</YueDisplay> 160</YueDisplay>
161 161
162The key-value tuple in a table comprehension can also come from a single expression, in which case the expression should return two values. The first is used as the key and the second is used as the value: 162Das Schlüssel-Wert-Tupel in einer Tabellen-Comprehension kann auch aus einem einzelnen Ausdruck stammen; der Ausdruck muss dann zwei Werte zurückgeben. Der erste wird als Schlüssel und der zweite als Wert verwendet:
163 163
164In this example we convert an array of pairs to a table where the first item in the pair is the key and the second is the value. 164In diesem Beispiel konvertieren wir ein Array von Paaren in eine Tabelle, wobei das erste Element des Paars der Schlüssel und das zweite der Wert ist.
165 165
166```yuescript 166```yuescript
167tuples = [ ["hello", "world"], ["foo", "bar"]] 167tuples = [ ["hallo", "Welt"], ["foo", "bar"]]
168tbl = {unpack tuple for tuple in *tuples} 168tbl = {unpack tuple for tuple in *tuples}
169``` 169```
170<YueDisplay> 170<YueDisplay>
171 171
172```yue 172```yue
173tuples = [ ["hello", "world"], ["foo", "bar"]] 173tuples = [ ["hallo", "Welt"], ["foo", "bar"]]
174tbl = {unpack tuple for tuple in *tuples} 174tbl = {unpack tuple for tuple in *tuples}
175``` 175```
176 176
@@ -178,9 +178,9 @@ tbl = {unpack tuple for tuple in *tuples}
178 178
179## Slicing 179## Slicing
180 180
181A special syntax is provided to restrict the items that are iterated over when using the **\*** operator. This is equivalent to setting the iteration bounds and a step size in a for loop. 181Eine spezielle Syntax erlaubt es, die iterierten Elemente bei Verwendung des **\***-Operators einzuschränken. Das ist äquivalent zum Setzen von Iterationsgrenzen und Schrittweite in einer `for`-Schleife.
182 182
183Here we can set the minimum and maximum bounds, taking all items with indexes between 1 and 5 inclusive: 183Hier setzen wir die minimalen und maximalen Grenzen und nehmen alle Elemente mit Indizes zwischen 1 und 5 (inklusive):
184 184
185```yuescript 185```yuescript
186slice = [item for item in *items[1, 5]] 186slice = [item for item in *items[1, 5]]
@@ -193,7 +193,7 @@ slice = [item for item in *items[1, 5]]
193 193
194</YueDisplay> 194</YueDisplay>
195 195
196Any of the slice arguments can be left off to use a sensible default. In this example, if the max index is left off it defaults to the length of the table. This will take everything but the first element: 196Jedes der Slice-Argumente kann weggelassen werden, um einen sinnvollen Standard zu verwenden. Wenn der maximale Index weggelassen wird, entspricht er der Länge der Tabelle. Dieses Beispiel nimmt alles außer dem ersten Element:
197 197
198```yuescript 198```yuescript
199slice = [item for item in *items[2,]] 199slice = [item for item in *items[2,]]
@@ -206,7 +206,7 @@ slice = [item for item in *items[2,]]
206 206
207</YueDisplay> 207</YueDisplay>
208 208
209If the minimum bound is left out, it defaults to 1. Here we only provide a step size and leave the other bounds blank. This takes all odd indexed items: (1, 3, 5, …) 209Wenn die Mindestgrenze weggelassen wird, ist sie standardmäßig 1. Hier geben wir nur die Schrittweite an und lassen die anderen Grenzen leer. Das nimmt alle ungerad indizierten Elemente (1, 3, 5, …):
210 210
211```yuescript 211```yuescript
212slice = [item for item in *items[,,2]] 212slice = [item for item in *items[,,2]]
@@ -219,22 +219,22 @@ slice = [item for item in *items[,,2]]
219 219
220</YueDisplay> 220</YueDisplay>
221 221
222Both the minimum and maximum bounds can be negative, which means that the bounds are counted from the end of the table. 222Sowohl die Mindest- als auch die Maximalgrenze können negativ sein; dann werden die Grenzen vom Ende der Tabelle gezählt.
223 223
224```yuescript 224```yuescript
225-- take the last 4 items 225-- die letzten 4 Elemente nehmen
226slice = [item for item in *items[-4,-1]] 226slice = [item for item in *items[-4,-1]]
227``` 227```
228<YueDisplay> 228<YueDisplay>
229 229
230```yue 230```yue
231-- take the last 4 items 231-- die letzten 4 Elemente nehmen
232slice = [item for item in *items[-4,-1]] 232slice = [item for item in *items[-4,-1]]
233``` 233```
234 234
235</YueDisplay> 235</YueDisplay>
236 236
237The step size can also be negative, which means that the items are taken in reverse order. 237Die Schrittweite kann ebenfalls negativ sein, wodurch die Elemente in umgekehrter Reihenfolge genommen werden.
238 238
239```yuescript 239```yuescript
240reverse_slice = [item for item in *items[-1,1,-1]] 240reverse_slice = [item for item in *items[-1,1,-1]]
@@ -247,24 +247,24 @@ reverse_slice = [item for item in *items[-1,1,-1]]
247 247
248</YueDisplay> 248</YueDisplay>
249 249
250### Slicing Expression 250### Slicing-Ausdruck
251 251
252Slicing can also be used as an expression. This is useful for getting a sub-list of a table. 252Slicing kann auch als Ausdruck verwendet werden. Das ist nützlich, um eine Teilliste einer Tabelle zu erhalten.
253 253
254```yuescript 254```yuescript
255-- take the 2nd and 4th items as a new list 255-- das 2. und 4. Element als neue Liste nehmen
256sub_list = items[2, 4] 256sub_list = items[2, 4]
257 257
258-- take the last 4 items 258-- die letzten 4 Elemente nehmen
259last_four_items = items[-4, -1] 259last_four_items = items[-4, -1]
260``` 260```
261<YueDisplay> 261<YueDisplay>
262 262
263```yue 263```yue
264-- take the 2nd and 4th items as a new list 264-- das 2. und 4. Element als neue Liste nehmen
265sub_list = items[2, 4] 265sub_list = items[2, 4]
266 266
267-- take the last 4 items 267-- die letzten 4 Elemente nehmen
268last_four_items = items[-4, -1] 268last_four_items = items[-4, -1]
269``` 269```
270 270
diff --git a/doc/docs/de/doc/data-structures/table-literals.md b/doc/docs/de/doc/data-structures/table-literals.md
index c1adcab..46181d7 100644
--- a/doc/docs/de/doc/data-structures/table-literals.md
+++ b/doc/docs/de/doc/data-structures/table-literals.md
@@ -1,6 +1,6 @@
1# Table Literals 1# Tabellenliterale
2 2
3Like in Lua, tables are delimited in curly braces. 3Wie in Lua werden Tabellen mit geschweiften Klammern definiert.
4 4
5```yuescript 5```yuescript
6some_values = [1, 2, 3, 4] 6some_values = [1, 2, 3, 4]
@@ -13,13 +13,13 @@ some_values = [1, 2, 3, 4]
13 13
14</YueDisplay> 14</YueDisplay>
15 15
16Unlike Lua, assigning a value to a key in a table is done with **:** (instead of **=**). 16Anders als in Lua weist man einem Schlüssel in einer Tabelle mit **:** (statt **=**) einen Wert zu.
17 17
18```yuescript 18```yuescript
19some_values = { 19some_values = {
20 name: "Bill", 20 name: "Bill",
21 age: 200, 21 age: 200,
22 ["favorite food"]: "rice" 22 ["Lieblingsessen"]: "Reis"
23} 23}
24``` 24```
25<YueDisplay> 25<YueDisplay>
@@ -28,39 +28,39 @@ some_values = {
28some_values = { 28some_values = {
29 name: "Bill", 29 name: "Bill",
30 age: 200, 30 age: 200,
31 ["favorite food"]: "rice" 31 ["Lieblingsessen"]: "Reis"
32} 32}
33``` 33```
34 34
35</YueDisplay> 35</YueDisplay>
36 36
37The curly braces can be left off if a single table of key value pairs is being assigned. 37Die geschweiften Klammern können weggelassen werden, wenn eine einzelne Tabelle aus Schlüssel-Wert-Paaren zugewiesen wird.
38 38
39```yuescript 39```yuescript
40profile = 40profile =
41 height: "4 feet", 41 height: "4 Fuß",
42 shoe_size: 13, 42 shoe_size: 13,
43 favorite_foods: ["ice cream", "donuts"] 43 favorite_foods: ["Eis", "Donuts"]
44``` 44```
45<YueDisplay> 45<YueDisplay>
46 46
47```yue 47```yue
48profile = 48profile =
49 height: "4 feet", 49 height: "4 Fuß",
50 shoe_size: 13, 50 shoe_size: 13,
51 favorite_foods: ["ice cream", "donuts"] 51 favorite_foods: ["Eis", "Donuts"]
52``` 52```
53 53
54</YueDisplay> 54</YueDisplay>
55 55
56Newlines can be used to delimit values instead of a comma (or both): 56Zeilenumbrüche können Werte statt eines Kommas trennen (oder zusätzlich):
57 57
58```yuescript 58```yuescript
59values = { 59values = {
60 1, 2, 3, 4 60 1, 2, 3, 4
61 5, 6, 7, 8 61 5, 6, 7, 8
62 name: "superman" 62 name: "Superman"
63 occupation: "crime fighting" 63 occupation: "Verbrechensbekämpfung"
64} 64}
65``` 65```
66<YueDisplay> 66<YueDisplay>
@@ -69,50 +69,50 @@ values = {
69values = { 69values = {
70 1, 2, 3, 4 70 1, 2, 3, 4
71 5, 6, 7, 8 71 5, 6, 7, 8
72 name: "superman" 72 name: "Superman"
73 occupation: "crime fighting" 73 occupation: "Verbrechensbekämpfung"
74} 74}
75``` 75```
76 76
77</YueDisplay> 77</YueDisplay>
78 78
79When creating a single line table literal, the curly braces can also be left off: 79Beim Erstellen eines einzeiligen Tabellenliterals können die geschweiften Klammern ebenfalls weggelassen werden:
80 80
81```yuescript 81```yuescript
82my_function dance: "Tango", partner: "none" 82my_function dance: "Tango", partner: "keiner"
83 83
84y = type: "dog", legs: 4, tails: 1 84y = type: "Hund", legs: 4, tails: 1
85``` 85```
86<YueDisplay> 86<YueDisplay>
87 87
88```yue 88```yue
89my_function dance: "Tango", partner: "none" 89my_function dance: "Tango", partner: "keiner"
90 90
91y = type: "dog", legs: 4, tails: 1 91y = type: "Hund", legs: 4, tails: 1
92``` 92```
93 93
94</YueDisplay> 94</YueDisplay>
95 95
96The keys of a table literal can be language keywords without being escaped: 96Die Schlüssel eines Tabellenliterals nnen Sprach-Schlüsselwörter sein, ohne sie zu escapen:
97 97
98```yuescript 98```yuescript
99tbl = { 99tbl = {
100 do: "something" 100 do: "etwas"
101 end: "hunger" 101 end: "Hunger"
102} 102}
103``` 103```
104<YueDisplay> 104<YueDisplay>
105 105
106```yue 106```yue
107tbl = { 107tbl = {
108 do: "something" 108 do: "etwas"
109 end: "hunger" 109 end: "Hunger"
110} 110}
111``` 111```
112 112
113</YueDisplay> 113</YueDisplay>
114 114
115If you are constructing a table out of variables and wish the keys to be the same as the variable names, then the **:** prefix operator can be used: 115Wenn du eine Tabelle aus Variablen konstruierst und die Schlüssel den Variablennamen entsprechen sollen, kannst du den Präfix-Operator **:** verwenden:
116 116
117```yuescript 117```yuescript
118hair = "golden" 118hair = "golden"
@@ -133,26 +133,26 @@ print_table :hair, :height
133 133
134</YueDisplay> 134</YueDisplay>
135 135
136If you want the key of a field in the table to to be result of an expression, then you can wrap it in **[ ]**, just like in Lua. You can also use a string literal directly as a key, leaving out the square brackets. This is useful if your key has any special characters. 136Wenn der Schlüssel eines Feldes das Ergebnis eines Ausdrucks sein soll, kannst du ihn wie in Lua in **[ ]** setzen. Du kannst auch ein String-Literal direkt als Schlüssel verwenden und die eckigen Klammern weglassen. Das ist nützlich, wenn dein Schlüssel Sonderzeichen enthält.
137 137
138```yuescript 138```yuescript
139t = { 139t = {
140 [1 + 2]: "hello" 140 [1 + 2]: "hallo"
141 "hello world": true 141 "Hallo Welt": true
142} 142}
143``` 143```
144<YueDisplay> 144<YueDisplay>
145 145
146```yue 146```yue
147t = { 147t = {
148 [1 + 2]: "hello" 148 [1 + 2]: "hallo"
149 "hello world": true 149 "Hallo Welt": true
150} 150}
151``` 151```
152 152
153</YueDisplay> 153</YueDisplay>
154 154
155Lua tables have both an array part and a hash part, but sometimes you want to make a semantic distinction between array and hash usage when writing Lua tables. Then you can write Lua table with **[ ]** instead of **{ }** to represent an array table and writing any key value pair in a list table won't be allowed. 155Lua-Tabellen haben einen Array-Teil und einen Hash-Teil, aber manchmal möchte man beim Schreiben von Lua-Tabellen eine semantische Unterscheidung zwischen Array- und Hash-Nutzung machen. Dann kannst du eine Lua-Tabelle mit **[ ]** statt **{ }** schreiben, um eine Array-Tabelle darzustellen, und das Schreiben von Schlüssel-Wert-Paaren in einer Listentabelle ist nicht erlaubt.
156 156
157```yuescript 157```yuescript
158some_values = [1, 2, 3, 4] 158some_values = [1, 2, 3, 4]
diff --git a/doc/docs/de/doc/functions/backcalls.md b/doc/docs/de/doc/functions/backcalls.md
index e34331e..dbac86b 100644
--- a/doc/docs/de/doc/functions/backcalls.md
+++ b/doc/docs/de/doc/functions/backcalls.md
@@ -1,21 +1,21 @@
1# Backcalls 1# Backcalls
2 2
3Backcalls are used for unnesting callbacks. They are defined using arrows pointed to the left as the last parameter by default filling in a function call. All the syntax is mostly the same as regular arrow functions except that it is just pointing the other way and the function body does not require indent. 3Backcalls werden verwendet, um Callbacks zu entkoppeln (unnesting). Sie werden mit Pfeilen nach links definiert und füllen standardmäßig als letzter Parameter einen Funktionsaufruf. Die Syntax ist weitgehend wie bei normalen Pfeilfunktionen, nur dass der Pfeil in die andere Richtung zeigt und der Funktionskörper keine Einrückung benötigt.
4 4
5```yuescript 5```yuescript
6x <- f 6x <- f
7print "hello" .. x 7print "hallo" .. x
8``` 8```
9<YueDisplay> 9<YueDisplay>
10 10
11```yue 11```yue
12x <- f 12x <- f
13print "hello" .. x 13print "hallo" .. x
14``` 14```
15 15
16</YueDisplay> 16</YueDisplay>
17 17
18Fat arrow functions are also available. 18Fat-Arrow-Funktionen sind ebenfalls verfügbar.
19 19
20```yuescript 20```yuescript
21<= f 21<= f
@@ -30,7 +30,7 @@ print @value
30 30
31</YueDisplay> 31</YueDisplay>
32 32
33You can specify a placeholder for where you want the backcall function to go as a parameter. 33Du kannst einen Platzhalter angeben, an welcher Stelle die Backcall-Funktion als Parameter eingesetzt werden soll.
34 34
35```yuescript 35```yuescript
36(x) <- map _, [1, 2, 3] 36(x) <- map _, [1, 2, 3]
@@ -45,11 +45,11 @@ x * 2
45 45
46</YueDisplay> 46</YueDisplay>
47 47
48If you wish to have further code after your backcalls, you can set them aside with a do statement. And the parentheses can be omitted with non-fat arrow functions. 48Wenn du nach deinen Backcalls weiteren Code haben willst, kannst du sie mit einem `do`-Statement absetzen. Bei Nicht-Fat-Arrow-Funktionen können die Klammern weggelassen werden.
49 49
50```yuescript 50```yuescript
51result, msg = do 51result, msg = do
52 data <- readAsync "filename.txt" 52 data <- readAsync "dateiname.txt"
53 print data 53 print data
54 info <- processAsync data 54 info <- processAsync data
55 check info 55 check info
@@ -59,7 +59,7 @@ print result, msg
59 59
60```yue 60```yue
61result, msg = do 61result, msg = do
62 data <- readAsync "filename.txt" 62 data <- readAsync "dateiname.txt"
63 print data 63 print data
64 info <- processAsync data 64 info <- processAsync data
65 check info 65 check info
diff --git a/doc/docs/de/doc/functions/function-literals.md b/doc/docs/de/doc/functions/function-literals.md
index 316e07c..d3bfb11 100644
--- a/doc/docs/de/doc/functions/function-literals.md
+++ b/doc/docs/de/doc/functions/function-literals.md
@@ -1,42 +1,42 @@
1# Function Literals 1# Funktionsliterale
2 2
3All functions are created using a function expression. A simple function is denoted using the arrow: **->**. 3Alle Funktionen werden mit einem Funktionsausdruck erstellt. Eine einfache Funktion wird mit dem Pfeil **->** notiert.
4 4
5```yuescript 5```yuescript
6my_function = -> 6my_function = ->
7my_function() -- call the empty function 7my_function() -- leere Funktion aufrufen
8``` 8```
9<YueDisplay> 9<YueDisplay>
10 10
11```yue 11```yue
12my_function = -> 12my_function = ->
13my_function() -- call the empty function 13my_function() -- leere Funktion aufrufen
14``` 14```
15 15
16</YueDisplay> 16</YueDisplay>
17 17
18The body of the function can either be one statement placed directly after the arrow, or it can be a series of statements indented on the following lines: 18Der Funktionskörper kann entweder eine einzelne Anweisung direkt nach dem Pfeil sein oder aus mehreren Anweisungen bestehen, die in den folgenden Zeilen eingerückt werden:
19 19
20```yuescript 20```yuescript
21func_a = -> print "hello world" 21func_a = -> print "Hallo Welt"
22 22
23func_b = -> 23func_b = ->
24 value = 100 24 value = 100
25 print "The value:", value 25 print "Der Wert:", value
26``` 26```
27<YueDisplay> 27<YueDisplay>
28 28
29```yue 29```yue
30func_a = -> print "hello world" 30func_a = -> print "Hallo Welt"
31 31
32func_b = -> 32func_b = ->
33 value = 100 33 value = 100
34 print "The value:", value 34 print "Der Wert:", value
35``` 35```
36 36
37</YueDisplay> 37</YueDisplay>
38 38
39If a function has no arguments, it can be called using the ! operator, instead of empty parentheses. The ! invocation is the preferred way to call functions with no arguments. 39Wenn eine Funktion keine Argumente hat, kann sie mit dem `!`-Operator statt leerer Klammern aufgerufen werden. Der `!`-Aufruf ist die bevorzugte Art, Funktionen ohne Argumente aufzurufen.
40 40
41```yuescript 41```yuescript
42func_a! 42func_a!
@@ -51,20 +51,20 @@ func_b()
51 51
52</YueDisplay> 52</YueDisplay>
53 53
54Functions with arguments can be created by preceding the arrow with a list of argument names in parentheses: 54Funktionen mit Argumenten werden erstellt, indem der Pfeil von einer Argumentliste in Klammern eingeleitet wird:
55 55
56```yuescript 56```yuescript
57sum = (x, y) -> print "sum", x + y 57sum = (x, y) -> print "Summe", x + y
58``` 58```
59<YueDisplay> 59<YueDisplay>
60 60
61```yue 61```yue
62sum = (x, y) -> print "sum", x + y 62sum = (x, y) -> print "Summe", x + y
63``` 63```
64 64
65</YueDisplay> 65</YueDisplay>
66 66
67Functions can be called by listing the arguments after the name of an expression that evaluates to a function. When chaining together function calls, the arguments are applied to the closest function to the left. 67Funktionen können aufgerufen werden, indem die Argumente hinter dem Namen eines Ausdrucks stehen, der zu einer Funktion evaluiert. Beim Verketten mehrerer Funktionsaufrufe werden die Argumente der nächstliegenden Funktion links zugeordnet.
68 68
69```yuescript 69```yuescript
70sum 10, 20 70sum 10, 20
@@ -83,7 +83,7 @@ a b c "a", "b", "c"
83 83
84</YueDisplay> 84</YueDisplay>
85 85
86In order to avoid ambiguity in when calling functions, parentheses can also be used to surround the arguments. This is required here in order to make sure the right arguments get sent to the right functions. 86Um Mehrdeutigkeiten beim Aufruf zu vermeiden, können die Argumente auch in Klammern gesetzt werden. Das ist hier nötig, damit die richtigen Argumente an die richtigen Funktionen gehen.
87 87
88```yuescript 88```yuescript
89print "x:", sum(10, 20), "y:", sum(30, 40) 89print "x:", sum(10, 20), "y:", sum(30, 40)
@@ -96,24 +96,24 @@ print "x:", sum(10, 20), "y:", sum(30, 40)
96 96
97</YueDisplay> 97</YueDisplay>
98 98
99There must not be any space between the opening parenthesis and the function. 99Zwischen öffnender Klammer und Funktionsname darf kein Leerzeichen stehen.
100 100
101Functions will coerce the last statement in their body into a return statement, this is called implicit return: 101Funktionen wandeln die letzte Anweisung im Funktionskörper in ein `return` um. Das nennt sich implizites Return:
102 102
103```yuescript 103```yuescript
104sum = (x, y) -> x + y 104sum = (x, y) -> x + y
105print "The sum is ", sum 10, 20 105print "Die Summe ist ", sum 10, 20
106``` 106```
107<YueDisplay> 107<YueDisplay>
108 108
109```yue 109```yue
110sum = (x, y) -> x + y 110sum = (x, y) -> x + y
111print "The sum is ", sum 10, 20 111print "Die Summe ist ", sum 10, 20
112``` 112```
113 113
114</YueDisplay> 114</YueDisplay>
115 115
116And if you need to explicitly return, you can use the return keyword: 116Wenn du explizit zurückgeben willst, verwende `return`:
117 117
118```yuescript 118```yuescript
119sum = (x, y) -> return x + y 119sum = (x, y) -> return x + y
@@ -126,7 +126,7 @@ sum = (x, y) -> return x + y
126 126
127</YueDisplay> 127</YueDisplay>
128 128
129Just like in Lua, functions can return multiple values. The last statement must be a list of values separated by commas: 129Wie in Lua können Funktionen mehrere Werte zurückgeben. Die letzte Anweisung muss eine Liste von Werten sein, getrennt durch Kommas:
130 130
131```yuescript 131```yuescript
132mystery = (x, y) -> x + y, x - y 132mystery = (x, y) -> x + y, x - y
@@ -143,7 +143,7 @@ a, b = mystery 10, 20
143 143
144## Fat Arrows 144## Fat Arrows
145 145
146Because it is an idiom in Lua to send an object as the first argument when calling a method, a special syntax is provided for creating functions which automatically includes a self argument. 146Da es in Lua üblich ist, beim Methodenaufruf ein Objekt als erstes Argument zu übergeben, gibt es eine spezielle Syntax zum Erstellen von Funktionen, die automatisch ein `self`-Argument enthalten.
147 147
148```yuescript 148```yuescript
149func = (num) => @value + num 149func = (num) => @value + num
@@ -156,26 +156,26 @@ func = (num) => @value + num
156 156
157</YueDisplay> 157</YueDisplay>
158 158
159## Argument Defaults 159## Standardwerte für Argumente
160 160
161It is possible to provide default values for the arguments of a function. An argument is determined to be empty if its value is nil. Any nil arguments that have a default value will be replace before the body of the function is run. 161Es ist möglich, Standardwerte für Funktionsargumente anzugeben. Ein Argument gilt als leer, wenn sein Wert `nil` ist. Alle `nil`-Argumente mit Standardwert werden vor Ausführung des Funktionskörpers ersetzt.
162 162
163```yuescript 163```yuescript
164my_function = (name = "something", height = 100) -> 164my_function = (name = "etwas", height = 100) ->
165 print "Hello I am", name 165 print "Hallo, ich bin", name
166 print "My height is", height 166 print "Meine Größe ist", height
167``` 167```
168<YueDisplay> 168<YueDisplay>
169 169
170```yue 170```yue
171my_function = (name = "something", height = 100) -> 171my_function = (name = "etwas", height = 100) ->
172 print "Hello I am", name 172 print "Hallo, ich bin", name
173 print "My height is", height 173 print "Meine Größe ist", height
174``` 174```
175 175
176</YueDisplay> 176</YueDisplay>
177 177
178An argument default value expression is evaluated in the body of the function in the order of the argument declarations. For this reason default values have access to previously declared arguments. 178Der Ausdruck für den Standardwert wird im Funktionskörper in der Reihenfolge der Argumentdeklarationen ausgewertet. Daher können Standardwerte auf zuvor deklarierte Argumente zugreifen.
179 179
180```yuescript 180```yuescript
181some_args = (x = 100, y = x + 1000) -> 181some_args = (x = 100, y = x + 1000) ->
@@ -190,11 +190,11 @@ some_args = (x = 100, y = x + 1000) ->
190 190
191</YueDisplay> 191</YueDisplay>
192 192
193## Considerations 193## Hinweise
194 194
195Because of the expressive parentheses-less way of calling functions, some restrictions must be put in place to avoid parsing ambiguity involving whitespace. 195Aufgrund der ausdrucksstarken, klammerlosen Funktionsaufrufe müssen einige Einschränkungen gelten, um Parsing-Mehrdeutigkeiten mit Leerraum zu vermeiden.
196 196
197The minus sign plays two roles, a unary negation operator and a binary subtraction operator. Consider how the following examples compile: 197Das Minuszeichen hat zwei Rollen: unäre Negation und binäre Subtraktion. Sieh dir an, wie die folgenden Beispiele kompiliert werden:
198 198
199```yuescript 199```yuescript
200a = x - 10 200a = x - 10
@@ -213,30 +213,30 @@ d = x- z
213 213
214</YueDisplay> 214</YueDisplay>
215 215
216The precedence of the first argument of a function call can be controlled using whitespace if the argument is a literal string. In Lua, it is common to leave off parentheses when calling a function with a single string or table literal. 216Die Präzedenz des ersten Arguments eines Funktionsaufrufs kann mit Leerraum gesteuert werden, wenn das Argument ein String-Literal ist. In Lua lässt man bei Aufrufen mit einem einzelnen String- oder Tabellenliteral häufig die Klammern weg.
217 217
218When there is no space between a variable and a string literal, the function call takes precedence over any following expressions. No other arguments can be passed to the function when it is called this way. 218Wenn kein Leerzeichen zwischen Variable und String-Literal steht, hat der Funktionsaufruf Vorrang vor nachfolgenden Ausdrücken. In dieser Form können keine weiteren Argumente übergeben werden.
219 219
220Where there is a space following a variable and a string literal, the function call acts as show above. The string literal belongs to any following expressions (if they exist), which serves as the argument list. 220Steht ein Leerzeichen zwischen Variable und String-Literal, verhält sich der Aufruf wie oben gezeigt. Das String-Literal gehört dann zu nachfolgenden Ausdrücken (falls vorhanden) und dient als Argumentliste.
221 221
222```yuescript 222```yuescript
223x = func"hello" + 100 223x = func"hallo" + 100
224y = func "hello" + 100 224y = func "hallo" + 100
225``` 225```
226<YueDisplay> 226<YueDisplay>
227 227
228```yue 228```yue
229x = func"hello" + 100 229x = func"hallo" + 100
230y = func "hello" + 100 230y = func "hallo" + 100
231``` 231```
232 232
233</YueDisplay> 233</YueDisplay>
234 234
235## Multi-line arguments 235## Mehrzeilige Argumente
236 236
237When calling functions that take a large number of arguments, it is convenient to split the argument list over multiple lines. Because of the white-space sensitive nature of the language, care must be taken when splitting up the argument list. 237Wenn Funktionsaufrufe viele Argumente haben, ist es praktisch, die Argumentliste auf mehrere Zeilen zu verteilen. Wegen der whitespace-sensitiven Natur der Sprache muss man dabei sorgfältig sein.
238 238
239If an argument list is to be continued onto the next line, the current line must end in a comma. And the following line must be indented more than the current indentation. Once indented, all other argument lines must be at the same level of indentation to be part of the argument list 239Wenn eine Argumentliste in der nächsten Zeile fortgesetzt wird, muss die aktuelle Zeile mit einem Komma enden. Die folgende Zeile muss stärker eingerückt sein als die aktuelle. Sobald eingerückt, müssen alle weiteren Argumentzeilen auf derselben Einrückungsebene liegen, um Teil der Argumentliste zu sein.
240 240
241```yuescript 241```yuescript
242my_func 5, 4, 3, 242my_func 5, 4, 3,
@@ -261,7 +261,7 @@ cool_func 1, 2,
261 261
262</YueDisplay> 262</YueDisplay>
263 263
264This type of invocation can be nested. The level of indentation is used to determine to which function the arguments belong to. 264Diese Art des Aufrufs kann verschachtelt werden. Die Einrückungsebene bestimmt, zu welcher Funktion die Argumente gehören.
265 265
266```yuescript 266```yuescript
267my_func 5, 6, 7, 267my_func 5, 6, 7,
@@ -280,7 +280,7 @@ my_func 5, 6, 7,
280 280
281</YueDisplay> 281</YueDisplay>
282 282
283Because tables also use the comma as a delimiter, this indentation syntax is helpful for letting values be part of the argument list instead of being part of the table. 283Da Tabellen ebenfalls das Komma als Trennzeichen verwenden, hilft diese Einrückungssyntax dabei, Werte zur Argumentliste gehören zu lassen, statt zur Tabelle.
284 284
285```yuescript 285```yuescript
286x = [ 286x = [
@@ -301,7 +301,7 @@ x = [
301 301
302</YueDisplay> 302</YueDisplay>
303 303
304Although uncommon, notice how we can give a deeper indentation for function arguments if we know we will be using a lower indentation further on. 304Obwohl es selten ist: Du kannst Funktionsargumente tiefer einrücken, wenn du weißt, dass du später eine geringere Einrückungsebene verwenden wirst.
305 305
306```yuescript 306```yuescript
307y = [ my_func 1, 2, 3, 307y = [ my_func 1, 2, 3,
@@ -320,46 +320,45 @@ y = [ my_func 1, 2, 3,
320 320
321</YueDisplay> 321</YueDisplay>
322 322
323The same thing can be done with other block level statements like conditionals. We can use indentation level to determine what statement a value belongs to: 323Dasselbe lässt sich mit anderen Block-Statements wie Bedingungen machen. Wir können die Einrückungsebene verwenden, um zu bestimmen, zu welcher Anweisung ein Wert gehört:
324 324
325```yuescript 325```yuescript
326if func 1, 2, 3, 326if func 1, 2, 3,
327 "hello", 327 "hallo",
328 "world" 328 "Welt"
329 print "hello" 329 print "hallo"
330 print "I am inside if" 330 print "Ich bin innerhalb der if-Bedingung"
331 331
332if func 1, 2, 3, 332if func 1, 2, 3,
333 "hello", 333 "hallo",
334 "world" 334 "Welt"
335 print "hello" 335 print "hallo"
336 print "I am inside if" 336 print "Ich bin innerhalb der if-Bedingung"
337``` 337```
338<YueDisplay> 338<YueDisplay>
339 339
340```yue 340```yue
341if func 1, 2, 3, 341if func 1, 2, 3,
342 "hello", 342 "hallo",
343 "world" 343 "Welt"
344 print "hello" 344 print "hallo"
345 print "I am inside if" 345 print "Ich bin innerhalb der if-Bedingung"
346 346
347if func 1, 2, 3, 347if func 1, 2, 3,
348 "hello", 348 "hallo",
349 "world" 349 "Welt"
350 print "hello" 350 print "hallo"
351 print "I am inside if" 351 print "Ich bin innerhalb der if-Bedingung"
352``` 352```
353 353
354</YueDisplay> 354</YueDisplay>
355 355
356## Parameter Destructuring 356## Parameter-Destructuring
357 357
358YueScript now supports destructuring function parameters when the argument is an object. Two forms of destructuring table literals are available: 358YueScript unterstützt jetzt Destructuring von Funktionsparametern, wenn das Argument ein Objekt ist. Es gibt zwei Formen von Destructuring-Tabellenliteralen:
359 359
360* **Curly-brace wrapped literals/object parameters**, allowing optional default values when fields are missing (e.g., `{:a, :b}`, `{a: a1 = 123}`). 360* **Geschweifte Klammern/Objektparameter**, die optionale Standardwerte erlauben, wenn Felder fehlen (z. B. `{:a, :b}`, `{a: a1 = 123}`).
361 361* **Unverpackte einfache Tabellensyntax**, die mit einer Sequenz aus Key-Value- oder Shorthand-Bindings beginnt und so lange läuft, bis ein anderer Ausdruck sie beendet (z. B. `:a, b: b1, :c`). Diese Form extrahiert mehrere Felder aus demselben Objekt.
362* **Unwrapped simple table syntax**, starting with a sequence of key-value or shorthand bindings and continuing until another expression terminates it (e.g., `:a, b: b1, :c`). This form extracts multiple fields from the same object.
363 362
364```yuescript 363```yuescript
365f1 = (:a, :b, :c) -> 364f1 = (:a, :b, :c) ->
@@ -390,9 +389,9 @@ f2 arg1, arg2
390 389
391</YueDisplay> 390</YueDisplay>
392 391
393## Prefixed Return Expression 392## Präfixiertes Return-Expression
394 393
395When working with deeply nested function bodies, it can be tedious to maintain readability and consistency of the return value. To address this, YueScript introduces the **Prefixed Return Expression** syntax. Its form is as follows: 394Wenn du mit tief verschachtelten Funktionskörpern arbeitest, kann es mühsam sein, die Lesbarkeit und Konsistenz des Rückgabewerts zu erhalten. Dafür führt YueScript die Syntax der **präfixierten Return-Expression** ein. Sie hat folgende Form:
396 395
397```yuescript 396```yuescript
398findFirstEven = (list): nil -> 397findFirstEven = (list): nil ->
@@ -415,7 +414,7 @@ findFirstEven = (list): nil ->
415 414
416</YueDisplay> 415</YueDisplay>
417 416
418This is equivalent to: 417Das ist äquivalent zu:
419 418
420```yuescript 419```yuescript
421findFirstEven = (list) -> 420findFirstEven = (list) ->
@@ -440,16 +439,16 @@ findFirstEven = (list) ->
440 439
441</YueDisplay> 440</YueDisplay>
442 441
443The only difference is that you can move the final return expression before the `->` or `=>` token to indicate the function’s implicit return value as the last statement. This way, even in functions with multiple nested loops or conditional branches, you no longer need to write a trailing return expression at the end of the function body, making the logic structure more straightforward and easier to follow. 442Der einzige Unterschied ist, dass du den finalen Rückgabeausdruck vor das `->`- oder `=>`-Token ziehen kannst, um den impliziten Rückgabewert der Funktion als letzte Anweisung zu kennzeichnen. So musst du selbst bei Funktionen mit mehreren verschachtelten Schleifen oder bedingten Zweigen kein abschließendes `return` am Ende des Funktionskörpers mehr schreiben, was die Logikstruktur klarer und leichter nachvollziehbar macht.
444 443
445## Named Varargs 444## Benannte Varargs
446 445
447You can use the `(...t) ->` syntax to automatically store varargs into a named table. This table will contain all passed arguments (including `nil` values), and the `n` field of the table will store the actual number of arguments passed (including `nil` values). 446Mit der Syntax `(...t) ->` kannst du Varargs automatisch in einer benannten Tabelle speichern. Diese Tabelle enthält alle übergebenen Argumente (einschließlich `nil`-Werten), und das Feld `n` der Tabelle speichert die tatsächliche Anzahl übergebener Argumente (einschließlich `nil`-Werten).
448 447
449```yuescript 448```yuescript
450f = (...t) -> 449f = (...t) ->
451 print "argument count:", t.n 450 print "Anzahl der Argumente:", t.n
452 print "table length:", #t 451 print "Tabellenlänge:", #t
453 for i = 1, t.n 452 for i = 1, t.n
454 print t[i] 453 print t[i]
455 454
@@ -457,7 +456,7 @@ f 1, 2, 3
457f "a", "b", "c", "d" 456f "a", "b", "c", "d"
458f! 457f!
459 458
460-- Handling cases with nil values 459-- lle mit nil-Werten behandeln
461process = (...args) -> 460process = (...args) ->
462 sum = 0 461 sum = 0
463 for i = 1, args.n 462 for i = 1, args.n
@@ -471,8 +470,8 @@ process 1, nil, 3, nil, 5
471 470
472```yue 471```yue
473f = (...t) -> 472f = (...t) ->
474 print "argument count:", t.n 473 print "Anzahl der Argumente:", t.n
475 print "table length:", #t 474 print "Tabellenlänge:", #t
476 for i = 1, t.n 475 for i = 1, t.n
477 print t[i] 476 print t[i]
478 477
@@ -480,7 +479,7 @@ f 1, 2, 3
480f "a", "b", "c", "d" 479f "a", "b", "c", "d"
481f! 480f!
482 481
483-- Handling cases with nil values 482-- lle mit nil-Werten behandeln
484process = (...args) -> 483process = (...args) ->
485 sum = 0 484 sum = 0
486 for i = 1, args.n 485 for i = 1, args.n
diff --git a/doc/docs/de/doc/functions/function-stubs.md b/doc/docs/de/doc/functions/function-stubs.md
index 57a8b0c..66b3ddb 100644
--- a/doc/docs/de/doc/functions/function-stubs.md
+++ b/doc/docs/de/doc/functions/function-stubs.md
@@ -1,27 +1,27 @@
1# Function Stubs 1# Funktions-Stubs
2 2
3It is common to pass a function from an object around as a value, for example, passing an instance method into a function as a callback. If the function expects the object it is operating on as the first argument then you must somehow bundle that object with the function so it can be called properly. 3Es ist üblich, eine Funktion eines Objekts als Wert weiterzureichen, z. B. eine Instanzmethode als Callback. Wenn die Funktion das Objekt, auf dem sie arbeitet, als erstes Argument erwartet, musst du dieses Objekt irgendwie mit der Funktion bündeln, damit sie korrekt aufgerufen werden kann.
4 4
5The function stub syntax is a shorthand for creating a new closure function that bundles both the object and function. This new function calls the wrapped function in the correct context of the object. 5Die Funktions-Stub-Syntax ist eine Kurzform, um eine neue Closure-Funktion zu erstellen, die sowohl Objekt als auch Funktion bündelt. Diese neue Funktion ruft die umschlossene Funktion im richtigen Kontext des Objekts auf.
6 6
7Its syntax is the same as calling an instance method with the \ operator but with no argument list provided. 7Die Syntax entspricht dem Aufruf einer Instanzmethode mit dem `\`-Operator, jedoch ohne Argumentliste.
8 8
9```yuescript 9```yuescript
10my_object = { 10my_object = {
11 value: 1000 11 value: 1000
12 write: => print "the value:", @value 12 write: => print "der Wert:", @value
13} 13}
14 14
15run_callback = (func) -> 15run_callback = (func) ->
16 print "running callback..." 16 print "Callback wird ausgeführt..."
17 func! 17 func!
18 18
19-- this will not work: 19-- das funktioniert nicht:
20-- the function has to no reference to my_object 20-- die Funktion darf keine Referenz auf my_object haben
21run_callback my_object.write 21run_callback my_object.write
22 22
23-- function stub syntax 23-- Funktions-Stub-Syntax
24-- lets us bundle the object into a new function 24-- bindet das Objekt in eine neue Funktion ein
25run_callback my_object\write 25run_callback my_object\write
26``` 26```
27<YueDisplay> 27<YueDisplay>
@@ -29,19 +29,19 @@ run_callback my_object\write
29```yue 29```yue
30my_object = { 30my_object = {
31 value: 1000 31 value: 1000
32 write: => print "the value:", @value 32 write: => print "der Wert:", @value
33} 33}
34 34
35run_callback = (func) -> 35run_callback = (func) ->
36 print "running callback..." 36 print "Callback wird ausgeführt..."
37 func! 37 func!
38 38
39-- this will not work: 39-- das funktioniert nicht:
40-- the function has to no reference to my_object 40-- die Funktion darf keine Referenz auf my_object haben
41run_callback my_object.write 41run_callback my_object.write
42 42
43-- function stub syntax 43-- Funktions-Stub-Syntax
44-- lets us bundle the object into a new function 44-- bindet das Objekt in eine neue Funktion ein
45run_callback my_object\write 45run_callback my_object\write
46``` 46```
47 47
diff --git a/doc/docs/de/doc/getting-started/installation.md b/doc/docs/de/doc/getting-started/installation.md
index a93ddfd..78187c7 100644
--- a/doc/docs/de/doc/getting-started/installation.md
+++ b/doc/docs/de/doc/getting-started/installation.md
@@ -1,43 +1,43 @@
1# Installation 1# Installation
2 2
3## Lua Module 3## Lua-Modul
4 4
5Install [luarocks](https://luarocks.org), a package manager for Lua modules. Then install it as a Lua module and executable with: 5Installiere [luarocks](https://luarocks.org), einen Paketmanager für Lua-Module. Installiere YueScript dann als Lua-Modul und ausführbare Datei mit:
6 6
7```shell 7```shell
8luarocks install yuescript 8luarocks install yuescript
9``` 9```
10 10
11Or you can build `yue.so` file with: 11Oder du kannst die Datei `yue.so` bauen mit:
12 12
13```shell 13```shell
14make shared LUAI=/usr/local/include/lua LUAL=/usr/local/lib/lua 14make shared LUAI=/usr/local/include/lua LUAL=/usr/local/lib/lua
15``` 15```
16 16
17Then get the binary file from path **bin/shared/yue.so**. 17Anschließend findest du die Binärdatei unter **bin/shared/yue.so**.
18 18
19## Build Binary Tool 19## Binär-Tool bauen
20 20
21Clone this repo, then build and install executable with: 21Klone dieses Repo und baue/installiere die ausführbare Datei mit:
22 22
23```shell 23```shell
24make install 24make install
25``` 25```
26 26
27Build YueScript tool without macro feature: 27YueScript-Tool ohne Makro-Feature bauen:
28 28
29```shell 29```shell
30make install NO_MACRO=true 30make install NO_MACRO=true
31``` 31```
32 32
33Build YueScript tool without built-in Lua binary: 33YueScript-Tool ohne eingebautes Lua-Binary bauen:
34 34
35```shell 35```shell
36make install NO_LUA=true 36make install NO_LUA=true
37``` 37```
38 38
39## Download Precompiled Binary 39## Vorgefertigtes Binary herunterladen
40 40
41You can download precompiled binary files, including binary executable files compatible with different Lua versions and library files. 41Du kannst vorkompilierte Binärdateien herunterladen, inklusive ausführbarer Dateien für unterschiedliche Lua-Versionen und Bibliotheksdateien.
42 42
43Download precompiled binary files from [here](https://github.com/IppClub/YueScript/releases). 43Lade vorkompilierte Binärdateien von [hier](https://github.com/IppClub/YueScript/releases) herunter.
diff --git a/doc/docs/de/doc/getting-started/introduction.md b/doc/docs/de/doc/getting-started/introduction.md
index a9a9389..38354c1 100644
--- a/doc/docs/de/doc/getting-started/introduction.md
+++ b/doc/docs/de/doc/getting-started/introduction.md
@@ -1,27 +1,27 @@
1# Introduction 1# Einführung
2 2
3YueScript 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. 3YueScript ist eine dynamische Sprache, die zu Lua kompiliert. Sie ist ein Dialekt von [MoonScript](https://github.com/leafo/moonscript). Code, der in YueScript geschrieben wird, ist ausdrucksstark und sehr kompakt. YueScript eignet sich zum Schreiben von veränderlicher Anwendungslogik mit besser wartbarem Code und läuft in eingebetteten Lua-Umgebungen wie Spielen oder Webservern.
4 4
5Yue (月) is the name of moon in Chinese and it's pronounced as [jyɛ]. 5Yue (月) ist das chinesische Wort r Mond und wird als [jyɛ] ausgesprochen.
6 6
7## An Overview of YueScript 7## Ein Überblick über YueScript
8 8
9```yuescript 9```yuescript
10-- import syntax 10-- Import-Syntax
11import p, to_lua from "yue" 11import p, to_lua from "yue"
12 12
13-- object literals 13-- Objekt-Literale
14inventory = 14inventory =
15 equipment: 15 equipment:
16 - "sword" 16 - "Schwert"
17 - "shield" 17 - "Schild"
18 items: 18 items:
19 - name: "potion" 19 - name: "Trank"
20 count: 10 20 count: 10
21 - name: "bread" 21 - name: "Brot"
22 count: 3 22 count: 3
23 23
24-- list comprehension 24-- Listen-Abstraktion
25map = (arr, action) -> 25map = (arr, action) ->
26 [action item for item in *arr] 26 [action item for item in *arr]
27 27
@@ -31,14 +31,14 @@ filter = (arr, cond) ->
31reduce = (arr, init, action): init -> 31reduce = (arr, init, action): init ->
32 init = action init, item for item in *arr 32 init = action init, item for item in *arr
33 33
34-- pipe operator 34-- Pipe-Operator
35[1, 2, 3] 35[1, 2, 3]
36 |> map (x) -> x * 2 36 |> map (x) -> x * 2
37 |> filter (x) -> x > 4 37 |> filter (x) -> x > 4
38 |> reduce 0, (a, b) -> a + b 38 |> reduce 0, (a, b) -> a + b
39 |> print 39 |> print
40 40
41-- metatable manipulation 41-- Metatable-Manipulation
42apple = 42apple =
43 size: 15 43 size: 15
44 <index>: 44 <index>:
@@ -47,28 +47,28 @@ apple =
47with apple 47with apple
48 p .size, .color, .<index> if .<>? 48 p .size, .color, .<index> if .<>?
49 49
50-- js-like export syntax 50-- export-Syntax (ähnlich wie in JavaScript)
51export 🌛 = "月之脚本" 51export 🌛 = "Skript des Mondes"
52``` 52```
53 53
54<YueDisplay> 54<YueDisplay>
55 55
56```yue 56```yue
57-- import syntax 57-- Import-Syntax
58import p, to_lua from "yue" 58import p, to_lua from "yue"
59 59
60-- object literals 60-- Objekt-Literale
61inventory = 61inventory =
62 equipment: 62 equipment:
63 - "sword" 63 - "Schwert"
64 - "shield" 64 - "Schild"
65 items: 65 items:
66 - name: "potion" 66 - name: "Trank"
67 count: 10 67 count: 10
68 - name: "bread" 68 - name: "Brot"
69 count: 3 69 count: 3
70 70
71-- list comprehension 71-- Listen-Abstraktion
72map = (arr, action) -> 72map = (arr, action) ->
73 [action item for item in *arr] 73 [action item for item in *arr]
74 74
@@ -78,14 +78,14 @@ filter = (arr, cond) ->
78reduce = (arr, init, action): init -> 78reduce = (arr, init, action): init ->
79 init = action init, item for item in *arr 79 init = action init, item for item in *arr
80 80
81-- pipe operator 81-- Pipe-Operator
82[1, 2, 3] 82[1, 2, 3]
83 |> map (x) -> x * 2 83 |> map (x) -> x * 2
84 |> filter (x) -> x > 4 84 |> filter (x) -> x > 4
85 |> reduce 0, (a, b) -> a + b 85 |> reduce 0, (a, b) -> a + b
86 |> print 86 |> print
87 87
88-- metatable manipulation 88-- Metatable-Manipulation
89apple = 89apple =
90 size: 15 90 size: 15
91 <index>: 91 <index>:
@@ -94,12 +94,12 @@ apple =
94with apple 94with apple
95 p .size, .color, .<index> if .<>? 95 p .size, .color, .<index> if .<>?
96 96
97-- js-like export syntax 97-- export-Syntax (ähnlich wie in JavaScript)
98export 🌛 = "月之脚本" 98export 🌛 = "Skript des Mondes"
99``` 99```
100 100
101</YueDisplay> 101</YueDisplay>
102 102
103## About Dora SSR 103## Über Dora SSR
104 104
105YueScript is being developed and maintained alongside the open-source game engine [Dora SSR](https://github.com/Dora-SSR/Dora-SSR). It has been used to create engine tools, game demos and prototypes, validating its capabilities in real-world scenarios while enhancing the Dora SSR development experience. \ No newline at end of file 105YueScript wird zusammen mit der Open-Source-Spiel-Engine [Dora SSR](https://github.com/Dora-SSR/Dora-SSR) entwickelt und gepflegt. Es wird zum Erstellen von Engine-Tools, Spiel-Demos und Prototypen eingesetzt und hat seine Leistungsfähigkeit in realen Szenarien unter Beweis gestellt, während es gleichzeitig die Dora-SSR-Entwicklungserfahrung verbessert.
diff --git a/doc/docs/de/doc/getting-started/usage.md b/doc/docs/de/doc/getting-started/usage.md
index 45161c6..f3c9333 100644
--- a/doc/docs/de/doc/getting-started/usage.md
+++ b/doc/docs/de/doc/getting-started/usage.md
@@ -1,20 +1,20 @@
1# Usage 1# Verwendung
2 2
3## Lua Module 3## Lua-Modul
4 4
5Use YueScript module in Lua: 5YueScript-Modul in Lua verwenden:
6 6
7* **Case 1** 7* **Fall 1**
8 8
9 Require "your_yuescript_entry.yue" in Lua. 9 "your_yuescript_entry.yue" in Lua require'n.
10 ```Lua 10 ```Lua
11 require("yue")("your_yuescript_entry") 11 require("yue")("your_yuescript_entry")
12 ``` 12 ```
13 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. 13 Dieser Code funktioniert weiterhin, wenn du "your_yuescript_entry.yue" im gleichen Pfad zu "your_yuescript_entry.lua" kompilierst. In den restlichen YueScript-Dateien verwendest du einfach normales **require** oder **import**. Die Zeilennummern in Fehlermeldungen werden korrekt behandelt.
14 14
15* **Case 2** 15* **Fall 2**
16 16
17 Require YueScript module and rewite message by hand. 17 YueScript-Modul require'n und das Fehlermapping manuell umschreiben.
18 18
19 ```lua 19 ```lua
20 local yue = require("yue") 20 local yue = require("yue")
@@ -26,15 +26,15 @@ Use YueScript module in Lua:
26 end) 26 end)
27 ``` 27 ```
28 28
29* **Case 3** 29* **Fall 3**
30 30
31 Use the YueScript compiler function in Lua. 31 Die YueScript-Compilerfunktion in Lua verwenden.
32 32
33 ```lua 33 ```lua
34 local yue = require("yue") 34 local yue = require("yue")
35 local codes, err, globals = yue.to_lua([[ 35 local codes, err, globals = yue.to_lua([[
36 f = -> 36 f = ->
37 print "hello world" 37 print "Hallo Welt"
38 f! 38 f!
39 ]],{ 39 ]],{
40 implicit_return_root = true, 40 implicit_return_root = true,
@@ -48,64 +48,66 @@ Use YueScript module in Lua:
48 }) 48 })
49 ``` 49 ```
50 50
51## YueScript Tool 51## YueScript-Tool
52 52
53Use YueScript tool with: 53YueScript-Tool verwenden mit:
54 54
55```shell 55```shell
56> yue -h 56> yue -h
57Usage: yue 57Verwendung: yue
58 [options] [<file/directory>] ... 58 [Optionen] [<Datei/Verzeichnis>] ...
59 yue -e <code_or_file> [args...] 59 yue -e <code_oder_datei> [argumente...]
60 yue -w [<directory>] [options] 60 yue -w [<verzeichnis>] [optionen]
61 yue - 61 yue -
62 62
63Notes: 63Hinweise:
64 - '-' / '--' must be the first and only argument. 64 - '-' / '--' muss das erste und einzige Argument sein.
65 - '-o/--output' can not be used with multiple input files. 65 - '-o/--output' kann nicht mit mehreren Eingabedateien verwendet werden.
66 - '-w/--watch' can not be used with file input (directory only). 66 - '-w/--watch' kann nicht mit Dateieingabe verwendet werden (nur Verzeichnisse).
67 - with '-e/--execute', remaining tokens are treated as script args. 67 - Mit '-e/--execute' werden verbleibende Tokens als Skriptargumente behandelt.
68 68
69Options: 69Optionen:
70 -h, --help Show this help message and exit. 70 -h, --help Zeigt diese Hilfemeldung an und beendet das Programm.
71 -e <str>, --execute <str> Execute a file or raw codes 71 -e <str>, --execute <str> Datei oder Quellcode ausführen
72 -m, --minify Generate minified codes 72 -m, --minify Minimierten Code erzeugen
73 -r, --rewrite Rewrite output to match original line numbers 73 -r, --rewrite Ausgabe so umschreiben, dass die Zeilennummern dem Original entsprechen
74 -t <output_to>, --output-to <output_to> 74 -t <ziel>, --output-to <ziel>
75 Specify where to place compiled files 75 Ziel für kompilierte Dateien angeben
76 -o <file>, --output <file> Write output to file 76 -o <datei>, --output <datei>
77 -p, --print Write output to standard out 77 Schreibe die Ausgabe in eine Datei
78 -b, --benchmark Dump compile time (doesn't write output) 78 -p, --print Schreibe die Ausgabe auf die Standardausgabe
79 -g, --globals Dump global variables used in NAME LINE COLUMN 79 -b, --benchmark Gibt die Kompilierungszeit aus (keine Ausgabe schreiben)
80 -s, --spaces Use spaces in generated codes instead of tabs 80 -g, --globals Gibt verwendete globale Variablen im Format NAME ZEILE SPALTE aus
81 -l, --line-numbers Write line numbers from source codes 81 -s, --spaces Verwende Leerzeichen anstelle von Tabs im generierten Code
82 -j, --no-implicit-return Disable implicit return at end of file 82 -l, --line-numbers Schreibe Zeilennummern aus dem Quellcode
83 -c, --reserve-comments Reserve comments before statement from source codes 83 -j, --no-implicit-return Deaktiviert implizites Rückgabe am Datei-Ende
84 -w [<dir>], --watch [<dir>] 84 -c, --reserve-comments Kommentare aus dem Quellcode vor Anweisungen beibehalten
85 Watch changes and compile every file under directory 85 -w [<verz>], --watch [<verz>]
86 -v, --version Print version 86 Änderungen beobachten und alle Dateien im Verzeichnis kompilieren
87 - Read from standard in, print to standard out 87 -v, --version Version ausgeben
88 (Must be first and only argument) 88 - Lese von Standardinput, schreibe auf Standardausgabe
89 -- Same as '-' (kept for backward compatibility) 89 (muss das erste und einzige Argument sein)
90 90 -- Wie '-', bleibt zur Abwärtskompatibilität bestehen
91 --target <version> Specify the Lua version that codes will be generated to 91
92 (version can only be 5.1 to 5.5) 92 --target <version> Gib an, welche Lua-Version erzeugt werden soll
93 --path <path_str> Append an extra Lua search path string to package.path 93 (Version nur von 5.1 bis 5.5 möglich)
94 --<key>=<value> Pass compiler option in key=value form (existing behavior) 94 --path <pfad_str> Füge einen zusätzlichen Lua-Suchpfad zu package.path hinzu
95 95 --<schlüssel>=<wert> Übertrage Compileroption im Schlüssel=Wert-Format (bestehendes Verhalten)
96 Execute without options to enter REPL, type symbol '$' 96
97 in a single line to start/stop multi-line mode 97 Ohne Optionen wird die REPL gestartet, gebe das Symbol '$'
98 in eine einzelne Zeile ein, um den Multi-Line-Modus zu starten/beenden
98``` 99```
99Use cases:
100 100
101Recursively compile every YueScript file with extension **.yue** under current path: **yue .** 101Anwendungsfälle:
102 102
103Compile and save results to a target path: **yue -t /target/path/ .** 103Rekursiv jede YueScript-Datei mit der Endung **.yue** unter dem aktuellen Pfad kompilieren: **yue .**
104 104
105Compile and reserve debug info: **yue -l .** 105Kompilieren und Ergebnisse in einen Zielpfad schreiben: **yue -t /target/path/ .**
106 106
107Compile and generate minified codes: **yue -m .** 107Kompilieren und Debug-Infos beibehalten: **yue -l .**
108 108
109Execute raw codes: **yue -e 'print 123'** 109Kompilieren und minifizierten Code erzeugen: **yue -m .**
110 110
111Execute a YueScript file: **yue -e main.yue** 111Rohcode ausführen: **yue -e 'print 123'**
112
113Eine YueScript-Datei ausführen: **yue -e main.yue**
diff --git a/doc/docs/de/doc/language-basics/attributes.md b/doc/docs/de/doc/language-basics/attributes.md
index e6fd5a7..0fa3654 100644
--- a/doc/docs/de/doc/language-basics/attributes.md
+++ b/doc/docs/de/doc/language-basics/attributes.md
@@ -1,21 +1,21 @@
1# Attributes 1# Attribute
2 2
3Syntax support for Lua 5.4 attributes. And you can still use both the `const` and `close` declaration and get constant check and scoped callback working when targeting Lua versions below 5.4. 3Syntax-Unterstützung für Lua-5.4-Attribute. Du kannst weiterhin die Deklarationen `const` und `close` verwenden und erhältst Konstantenprüfung sowie Scoped-Callbacks, wenn du auf Lua-Versionen unter 5.4 zielst.
4 4
5```yuescript 5```yuescript
6const a = 123 6const a = 123
7close _ = <close>: -> print "Out of scope." 7close _ = <close>: -> print "Außerhalb des Gültigkeitsbereichs."
8``` 8```
9<YueDisplay> 9<YueDisplay>
10 10
11```yue 11```yue
12const a = 123 12const a = 123
13close _ = <close>: -> print "Out of scope." 13close _ = <close>: -> print "Außerhalb des Gültigkeitsbereichs."
14``` 14```
15 15
16</YueDisplay> 16</YueDisplay>
17 17
18You can do desctructuring with variables attributed as constant. 18Du kannst Destructuring mit als konstant markierten Variablen verwenden.
19 19
20```yuescript 20```yuescript
21const {:a, :b, c, d} = tb 21const {:a, :b, c, d} = tb
@@ -30,7 +30,7 @@ const {:a, :b, c, d} = tb
30 30
31</YueDisplay> 31</YueDisplay>
32 32
33You can also declare a global variable to be `const`. 33Du kannst auch eine globale Variable als `const` deklarieren.
34 34
35```yuescript 35```yuescript
36global const Constant = 123 36global const Constant = 123
diff --git a/doc/docs/de/doc/language-basics/comment.md b/doc/docs/de/doc/language-basics/comment.md
index b67c97d..dec9bb0 100644
--- a/doc/docs/de/doc/language-basics/comment.md
+++ b/doc/docs/de/doc/language-basics/comment.md
@@ -1,30 +1,30 @@
1# Comment 1# Kommentare
2 2
3```yuescript 3```yuescript
4-- I am a comment 4-- Ich bin ein Kommentar
5 5
6str = --[[ 6str = --[[
7This is a multi-line comment. 7Dies ist ein mehrzeiliger Kommentar.
8It's OK. 8Alles okay.
9]] strA \ -- comment 1 9]] strA \ -- Kommentar 1
10 .. strB \ -- comment 2 10 .. strB \ -- Kommentar 2
11 .. strC 11 .. strC
12 12
13func --[[port]] 3000, --[[ip]] "192.168.1.1" 13func --[[Port]] 3000, --[[IP]] "192.168.1.1"
14``` 14```
15<YueDisplay> 15<YueDisplay>
16 16
17```yue 17```yue
18-- I am a comment 18-- Ich bin ein Kommentar
19 19
20str = --[[ 20str = --[[
21This is a multi-line comment. 21Dies ist ein mehrzeiliger Kommentar.
22It's OK. 22Alles okay.
23]] strA \ -- comment 1 23]] strA \ -- Kommentar 1
24 .. strB \ -- comment 2 24 .. strB \ -- Kommentar 2
25 .. strC 25 .. strC
26 26
27func --[[port]] 3000, --[[ip]] "192.168.1.1" 27func --[[Port]] 3000, --[[IP]] "192.168.1.1"
28``` 28```
29 29
30</YueDisplay> 30</YueDisplay>
diff --git a/doc/docs/de/doc/language-basics/literals.md b/doc/docs/de/doc/language-basics/literals.md
index e097c62..55a5aaa 100644
--- a/doc/docs/de/doc/language-basics/literals.md
+++ b/doc/docs/de/doc/language-basics/literals.md
@@ -1,33 +1,33 @@
1# Literals 1# Literale
2 2
3All of the primitive literals in Lua can be used. This applies to numbers, strings, booleans, and **nil**. 3Alle primitiven Literale in Lua nnen verwendet werden. Das gilt r Zahlen, Strings, Booleans und **nil**.
4 4
5Unlike Lua, Line breaks are allowed inside of single and double quote strings without an escape sequence: 5Anders als in Lua sind Zeilenumbrüche innerhalb einfacher und doppelter Anführungszeichen ohne Escape-Sequenz erlaubt:
6 6
7```yuescript 7```yuescript
8some_string = "Here is a string 8some_string = "Hier ist ein String
9 that has a line break in it." 9 mit einem Zeilenumbruch."
10 10
11-- You can mix expressions into string literals using #{} syntax. 11-- Mit der #{}-Syntax kannst du Ausdrücke in String-Literale einbinden.
12-- String interpolation is only available in double quoted strings. 12-- String-Interpolation gibt es nur in doppelt angeführten Strings.
13print "I am #{math.random! * 100}% sure." 13print "Ich bin mir zu #{math.random! * 100}% sicher."
14``` 14```
15<YueDisplay> 15<YueDisplay>
16 16
17```yue 17```yue
18some_string = "Here is a string 18some_string = "Hier ist ein String
19 that has a line break in it." 19 mit einem Zeilenumbruch."
20 20
21-- You can mix expressions into string literals using #{} syntax. 21-- Mit der #{}-Syntax kannst du Ausdrücke in String-Literale einbinden.
22-- String interpolation is only available in double quoted strings. 22-- String-Interpolation gibt es nur in doppelt angeführten Strings.
23print "I am #{math.random! * 100}% sure." 23print "Ich bin mir zu #{math.random! * 100}% sicher."
24``` 24```
25 25
26</YueDisplay> 26</YueDisplay>
27 27
28## Number Literals 28## Zahlenliterale
29 29
30You can use underscores in a number literal to increase readability. 30Du kannst Unterstriche in Zahlenliteralen verwenden, um die Lesbarkeit zu erhöhen.
31 31
32```yuescript 32```yuescript
33integer = 1_000_000 33integer = 1_000_000
@@ -44,9 +44,9 @@ binary = 0B10011
44 44
45</YueDisplay> 45</YueDisplay>
46 46
47## YAML Multiline String 47## YAML-Mehrzeilen-String
48 48
49The `|` prefix introduces a YAML-style multiline string literal: 49Das Präfix `|` führt ein mehrzeiliges String-Literal im YAML-Stil ein:
50 50
51```yuescript 51```yuescript
52str = | 52str = |
@@ -67,9 +67,9 @@ str = |
67 67
68</YueDisplay> 68</YueDisplay>
69 69
70This allows writing structured multiline text conveniently. All line breaks and indentation are preserved relative to the first non-empty line, and expressions inside `#{...}` are interpolated automatically as `tostring(expr)`. 70Damit lässt sich strukturierter, mehrzeiliger Text bequem schreiben. Alle Zeilenumbrüche und Einrückungen bleiben relativ zur ersten nicht-leeren Zeile erhalten, und Ausdrücke innerhalb von `#{...}` werden automatisch als `tostring(expr)` interpoliert.
71 71
72YAML Multiline String automatically detects the common leading whitespace prefix (minimum indentation across all non-empty lines) and removes it from all lines. This makes it easy to indent your code visually without affecting the resulting string content. 72Der YAML-Mehrzeilen-String erkennt automatisch das gemeinsame führende Leerraumpräfix (minimale Einrückung über alle nicht-leeren Zeilen) und entfernt es aus allen Zeilen. So kannst du deinen Code optisch einrücken, ohne den resultierenden String zu verändern.
73 73
74```yuescript 74```yuescript
75fn = -> 75fn = ->
@@ -90,9 +90,9 @@ fn = ->
90 90
91</YueDisplay> 91</YueDisplay>
92 92
93Internal indentation is preserved relative to the removed common prefix, allowing clean nested structures. 93Die interne Einrückung bleibt relativ zum entfernten gemeinsamen Präfix erhalten, wodurch saubere, verschachtelte Strukturen möglich sind.
94 94
95All special characters like quotes (`"`) and backslashes (`\`) in the YAMLMultiline block are automatically escaped so that the generated Lua string is syntactically valid and behaves as expected. 95Alle Sonderzeichen wie Anführungszeichen (`"`) und Backslashes (`\`) im YAML-Mehrzeilen-Block werden automatisch escaped, sodass der erzeugte Lua-String syntaktisch korrekt ist und wie erwartet funktioniert.
96 96
97```yuescript 97```yuescript
98str = | 98str = |
diff --git a/doc/docs/de/doc/language-basics/operator.md b/doc/docs/de/doc/language-basics/operator.md
index 9a2e89b..a7b8c5c 100644
--- a/doc/docs/de/doc/language-basics/operator.md
+++ b/doc/docs/de/doc/language-basics/operator.md
@@ -1,6 +1,6 @@
1# Operator 1# Operatoren
2 2
3All of Lua's binary and unary operators are available. Additionally **!=** is as an alias for **~=**, and either **\\** or **::** can be used to write a chaining function call like `tb\func!` or `tb::func!`. And Yuescipt offers some other special operators to write more expressive codes. 3Alle binären und unären Operatoren von Lua sind verfügbar. Zusätzlich ist **!=** ein Alias für **~=**, und entweder **\** oder **::** kann für verkettete Funktionsaufrufe wie `tb\func!` oder `tb::func!` verwendet werden. Außerdem bietet YueScript einige spezielle Operatoren für ausdrucksstärkeren Code.
4 4
5```yuescript 5```yuescript
6tb\func! if tb ~= nil 6tb\func! if tb ~= nil
@@ -15,32 +15,32 @@ tb::func! if tb != nil
15 15
16</YueDisplay> 16</YueDisplay>
17 17
18## Chaining Comparisons 18## Verkettete Vergleiche
19 19
20Comparisons can be arbitrarily chained: 20Vergleiche können beliebig verkettet werden:
21 21
22```yuescript 22```yuescript
23print 1 < 2 <= 2 < 3 == 3 > 2 >= 1 == 1 < 3 != 5 23print 1 < 2 <= 2 < 3 == 3 > 2 >= 1 == 1 < 3 != 5
24-- output: true 24-- Ausgabe: true
25 25
26a = 5 26a = 5
27print 1 <= a <= 10 27print 1 <= a <= 10
28-- output: true 28-- Ausgabe: true
29``` 29```
30<YueDisplay> 30<YueDisplay>
31 31
32```yue 32```yue
33print 1 < 2 <= 2 < 3 == 3 > 2 >= 1 == 1 < 3 != 5 33print 1 < 2 <= 2 < 3 == 3 > 2 >= 1 == 1 < 3 != 5
34-- output: true 34-- Ausgabe: true
35 35
36a = 5 36a = 5
37print 1 <= a <= 10 37print 1 <= a <= 10
38-- output: true 38-- Ausgabe: true
39``` 39```
40 40
41</YueDisplay> 41</YueDisplay>
42 42
43Note the evaluation behavior of chained comparisons: 43Beachte das Auswertungsverhalten verketteter Vergleiche:
44 44
45```yuescript 45```yuescript
46v = (x) -> 46v = (x) ->
@@ -49,7 +49,7 @@ v = (x) ->
49 49
50print v(1) < v(2) <= v(3) 50print v(1) < v(2) <= v(3)
51--[[ 51--[[
52 output: 52 Ausgabe:
53 2 53 2
54 1 54 1
55 3 55 3
@@ -58,7 +58,7 @@ print v(1) < v(2) <= v(3)
58 58
59print v(1) > v(2) <= v(3) 59print v(1) > v(2) <= v(3)
60--[[ 60--[[
61 output: 61 Ausgabe:
62 2 62 2
63 1 63 1
64 false 64 false
@@ -73,7 +73,7 @@ v = (x) ->
73 73
74print v(1) < v(2) <= v(3) 74print v(1) < v(2) <= v(3)
75--[[ 75--[[
76 output: 76 Ausgabe:
77 2 77 2
78 1 78 1
79 3 79 3
@@ -82,7 +82,7 @@ print v(1) < v(2) <= v(3)
82 82
83print v(1) > v(2) <= v(3) 83print v(1) > v(2) <= v(3)
84--[[ 84--[[
85 output: 85 Ausgabe:
86 2 86 2
87 1 87 1
88 false 88 false
@@ -91,32 +91,32 @@ print v(1) > v(2) <= v(3)
91 91
92</YueDisplay> 92</YueDisplay>
93 93
94The middle expression is only evaluated once, rather than twice as it would be if the expression were written as `v(1) < v(2) and v(2) <= v(3)`. However, the order of evaluations in a chained comparison is undefined. It is strongly recommended not to use expressions with side effects (such as printing) in chained comparisons. If side effects are required, the short-circuit `and` operator should be used explicitly. 94Der mittlere Ausdruck wird nur einmal ausgewertet, nicht zweimal wie bei `v(1) < v(2) and v(2) <= v(3)`. Die Auswertungsreihenfolge in verketteten Vergleichen ist jedoch undefiniert. Es wird dringend empfohlen, in verketteten Vergleichen keine Ausdrücke mit Seiteneffekten (z. B. `print`) zu verwenden. Wenn Seiteneffekte nötig sind, sollte der Short-Circuit-Operator `and` explizit verwendet werden.
95 95
96## Table Appending 96## Tabellenerweiterung
97 97
98The **[] =** operator is used to append values to tables. 98Der Operator **[] =** wird verwendet, um Werte an Tabellen anzuhängen.
99 99
100```yuescript 100```yuescript
101tab = [] 101tab = []
102tab[] = "Value" 102tab[] = "Wert"
103``` 103```
104<YueDisplay> 104<YueDisplay>
105 105
106```yue 106```yue
107tab = [] 107tab = []
108tab[] = "Value" 108tab[] = "Wert"
109``` 109```
110 110
111</YueDisplay> 111</YueDisplay>
112 112
113You can also use the spread operator `...` to append all elements from one list to another: 113Du kannst auch den Spread-Operator `...` verwenden, um alle Elemente einer Liste an eine andere anzuhängen:
114 114
115```yuescript 115```yuescript
116tbA = [1, 2, 3] 116tbA = [1, 2, 3]
117tbB = [4, 5, 6] 117tbB = [4, 5, 6]
118tbA[] = ...tbB 118tbA[] = ...tbB
119-- tbA is now [1, 2, 3, 4, 5, 6] 119-- tbA ist jetzt [1, 2, 3, 4, 5, 6]
120``` 120```
121<YueDisplay> 121<YueDisplay>
122 122
@@ -124,24 +124,24 @@ tbA[] = ...tbB
124tbA = [1, 2, 3] 124tbA = [1, 2, 3]
125tbB = [4, 5, 6] 125tbB = [4, 5, 6]
126tbA[] = ...tbB 126tbA[] = ...tbB
127-- tbA is now [1, 2, 3, 4, 5, 6] 127-- tbA ist jetzt [1, 2, 3, 4, 5, 6]
128``` 128```
129 129
130</YueDisplay> 130</YueDisplay>
131 131
132## Table Spreading 132## Tabellen-Spread
133 133
134You can concatenate array tables or hash tables using spread operator `...` before expressions in table literals. 134Du kannst Array-Tabellen oder Hash-Tabellen mit dem Spread-Operator `...` vor Ausdrücken in Tabellenliteralen zusammenführen.
135 135
136```yuescript 136```yuescript
137parts = 137parts =
138 * "shoulders" 138 * "Schultern"
139 * "knees" 139 * "Knie"
140lyrics = 140lyrics =
141 * "head" 141 * "Kopf"
142 * ...parts 142 * ...parts
143 * "and" 143 * "und"
144 * "toes" 144 * "Zehen"
145 145
146copy = {...other} 146copy = {...other}
147 147
@@ -153,13 +153,13 @@ merge = {...a, ...b}
153 153
154```yue 154```yue
155parts = 155parts =
156 * "shoulders" 156 * "Schultern"
157 * "knees" 157 * "Knie"
158lyrics = 158lyrics =
159 * "head" 159 * "Kopf"
160 * ...parts 160 * ...parts
161 * "and" 161 * "und"
162 * "toes" 162 * "Zehen"
163 163
164copy = {...other} 164copy = {...other}
165 165
@@ -170,9 +170,9 @@ merge = {...a, ...b}
170 170
171</YueDisplay> 171</YueDisplay>
172 172
173## Table Reversed Indexing 173## Umgekehrter Tabellenindex
174 174
175You can use the **#** operator to get the last elements of a table. 175Mit dem Operator **#** kannst du auf die letzten Elemente einer Tabelle zugreifen.
176 176
177```yuescript 177```yuescript
178last = data.items[#] 178last = data.items[#]
@@ -191,11 +191,11 @@ data.items[#] = 1
191 191
192## Metatable 192## Metatable
193 193
194The **<>** operator can be used as a shortcut for metatable manipulation. 194Der Operator **<>** kann als Abkürzung für Metatable-Manipulation verwendet werden.
195 195
196### Metatable Creation 196### Metatable erstellen
197 197
198Create normal table with empty bracekets **<>** or metamethod key which is surrounded by **<>**. 198Erzeuge eine normale Tabelle mit leeren Klammern **<>** oder einem Metamethod-Schssel, der von **<>** umschlossen ist.
199 199
200```yuescript 200```yuescript
201mt = {} 201mt = {}
@@ -203,14 +203,14 @@ add = (right) => <>: mt, value: @value + right.value
203mt.__add = add 203mt.__add = add
204 204
205a = <>: mt, value: 1 205a = <>: mt, value: 1
206 -- set field with variable of the same name 206 -- Feld mit gleichnamiger Variable setzen
207b = :<add>, value: 2 207b = :<add>, value: 2
208c = <add>: mt.__add, value: 3 208c = <add>: mt.__add, value: 3
209 209
210d = a + b + c 210d = a + b + c
211print d.value 211print d.value
212 212
213close _ = <close>: -> print "out of scope" 213close _ = <close>: -> print "Außerhalb des Gültigkeitsbereichs"
214``` 214```
215<YueDisplay> 215<YueDisplay>
216 216
@@ -220,47 +220,47 @@ add = (right) => <>: mt, value: @value + right.value
220mt.__add = add 220mt.__add = add
221 221
222a = <>: mt, value: 1 222a = <>: mt, value: 1
223 -- set field with variable of the same name 223 -- Feld mit gleichnamiger Variable setzen
224b = :<add>, value: 2 224b = :<add>, value: 2
225c = <add>: mt.__add, value: 3 225c = <add>: mt.__add, value: 3
226 226
227d = a + b + c 227d = a + b + c
228print d.value 228print d.value
229 229
230close _ = <close>: -> print "out of scope" 230close _ = <close>: -> print "Außerhalb des Gültigkeitsbereichs"
231``` 231```
232 232
233</YueDisplay> 233</YueDisplay>
234 234
235### Metatable Accessing 235### Metatable-Zugriff
236 236
237Accessing metatable with **<>** or metamethod name surrounded by **<>** or writing some expression in **<>**. 237Metatable mit **<>** oder einem von **<>** umschlossenen Metamethod-Namen aufrufen oder einen Ausdruck in **<>** schreiben.
238 238
239```yuescript 239```yuescript
240-- create with metatable containing field "value" 240-- erstellen mit Metatable, das das Feld "value" enthält
241tb = <"value">: 123 241tb = <"value">: 123
242tb.<index> = tb.<> 242tb.<index> = tb.<>
243print tb.value 243print tb.value
244 244
245tb.<> = __index: {item: "hello"} 245tb.<> = __index: {item: "hallo"}
246print tb.item 246print tb.item
247``` 247```
248<YueDisplay> 248<YueDisplay>
249 249
250```yue 250```yue
251-- create with metatable containing field "value" 251-- erstellen mit Metatable, das das Feld "value" enthält
252tb = <"value">: 123 252tb = <"value">: 123
253tb.<index> = tb.<> 253tb.<index> = tb.<>
254print tb.value 254print tb.value
255tb.<> = __index: {item: "hello"} 255tb.<> = __index: {item: "hallo"}
256print tb.item 256print tb.item
257``` 257```
258 258
259</YueDisplay> 259</YueDisplay>
260 260
261### Metatable Destructure 261### Metatable-Destrukturierung
262 262
263Destruct metatable with metamethod key surrounded by **<>**. 263Destrukturiere Metatable mit Metamethoden-Schlüssel, der von **<>** umschlossen ist.
264 264
265```yuescript 265```yuescript
266{item, :new, :<close>, <index>: getter} = tb 266{item, :new, :<close>, <index>: getter} = tb
@@ -275,9 +275,9 @@ print item, new, close, getter
275 275
276</YueDisplay> 276</YueDisplay>
277 277
278## Existence 278## Existenz
279 279
280The **?** operator can be used in a variety of contexts to check for existence. 280Der Operator **?** kann in verschiedenen Kontexten verwendet werden, um die Existenz zu prüfen.
281 281
282```yuescript 282```yuescript
283func?! 283func?!
@@ -314,14 +314,14 @@ with? io.open "test.txt", "w"
314 314
315## Piping 315## Piping
316 316
317Instead of a series of nested function calls, you can pipe values with operator **|>**. 317Anstelle einer Reihe verschachtelter Funktionsaufrufe kannst du Werte mit dem Operator **|>** weiterleiten.
318 318
319```yuescript 319```yuescript
320"hello" |> print 320"hello" |> print
3211 |> print 2 -- insert pipe item as the first argument 3211 |> print 2 -- Pipe-Element als erstes Argument einfügen
3222 |> print 1, _, 3 -- pipe with a placeholder 3222 |> print 1, _, 3 -- Pipe mit Platzhalter
323 323
324-- pipe expression in multiline 324-- Pipe-Ausdruck über mehrere Zeilen
325readFile "example.txt" 325readFile "example.txt"
326 |> extract language, {} 326 |> extract language, {}
327 |> parse language 327 |> parse language
@@ -333,9 +333,9 @@ readFile "example.txt"
333 333
334```yue 334```yue
335"hello" |> print 335"hello" |> print
3361 |> print 2 -- insert pipe item as the first argument 3361 |> print 2 -- Pipe-Element als erstes Argument einfügen
3372 |> print 1, _, 3 -- pipe with a placeholder 3372 |> print 1, _, 3 -- Pipe mit Platzhalter
338-- pipe expression in multiline 338-- Pipe-Ausdruck über mehrere Zeilen
339readFile "example.txt" 339readFile "example.txt"
340 |> extract language, {} 340 |> extract language, {}
341 |> parse language 341 |> parse language
@@ -346,9 +346,10 @@ readFile "example.txt"
346 346
347</YueDisplay> 347</YueDisplay>
348 348
349## Nil Coalescing 349## Nil-Coalescing
350
351Der Nil-Coalescing-Operator **??** gibt den Wert des linken Operanden zurück, wenn er nicht **nil** ist; andernfalls wird der rechte Operand ausgewertet und sein Ergebnis zurückgegeben. Der **??**-Operator wertet seinen rechten Operanden nicht aus, wenn der linke Operand nicht nil ergibt.
350 352
351The nil-coalescing operator **??** returns the value of its left-hand operand if it isn't **nil**; otherwise, it evaluates the right-hand operand and returns its result. The **??** operator doesn't evaluate its right-hand operand if the left-hand operand evaluates to non-nil.
352```yuescript 353```yuescript
353local a, b, c, d 354local a, b, c, d
354a = b ?? c ?? d 355a = b ?? c ?? d
@@ -367,31 +368,31 @@ a ??= false
367 368
368</YueDisplay> 369</YueDisplay>
369 370
370## Implicit Object 371## Implizites Objekt
371 372
372You can write a list of implicit structures that starts with the symbol **\*** or **-** inside a table block. If you are creating implicit object, the fields of the object must be with the same indent. 373Du kannst innerhalb eines Tabellenblocks eine Liste impliziter Strukturen schreiben, die mit dem Symbol **\*** oder **-** beginnt. Beim Erstellen eines impliziten Objekts müssen die Felder des Objekts dieselbe Einrückung haben.
373 374
374```yuescript 375```yuescript
375-- assignment with implicit object 376-- Zuweisung mit implizitem Objekt
376list = 377list =
377 * 1 378 * 1
378 * 2 379 * 2
379 * 3 380 * 3
380 381
381-- function call with implicit object 382-- Funktionsaufruf mit implizitem Objekt
382func 383func
383 * 1 384 * 1
384 * 2 385 * 2
385 * 3 386 * 3
386 387
387-- return with implicit object 388-- Rückgabe mit implizitem Objekt
388f = -> 389f = ->
389 return 390 return
390 * 1 391 * 1
391 * 2 392 * 2
392 * 3 393 * 3
393 394
394-- table with implicit object 395-- Tabelle mit implizitem Objekt
395tb = 396tb =
396 name: "abc" 397 name: "abc"
397 398
@@ -416,26 +417,26 @@ tb =
416<YueDisplay> 417<YueDisplay>
417 418
418```yue 419```yue
419-- assignment with implicit object 420-- Zuweisung mit implizitem Objekt
420list = 421list =
421 * 1 422 * 1
422 * 2 423 * 2
423 * 3 424 * 3
424 425
425-- function call with implicit object 426-- Funktionsaufruf mit implizitem Objekt
426func 427func
427 * 1 428 * 1
428 * 2 429 * 2
429 * 3 430 * 3
430 431
431-- return with implicit object 432-- Rückgabe mit implizitem Objekt
432f = -> 433f = ->
433 return 434 return
434 * 1 435 * 1
435 * 2 436 * 2
436 * 3 437 * 3
437 438
438-- table with implicit object 439-- Tabelle mit implizitem Objekt
439tb = 440tb =
440 name: "abc" 441 name: "abc"
441 442
diff --git a/doc/docs/de/doc/language-basics/whitespace.md b/doc/docs/de/doc/language-basics/whitespace.md
index d742a2b..9d5889d 100644
--- a/doc/docs/de/doc/language-basics/whitespace.md
+++ b/doc/docs/de/doc/language-basics/whitespace.md
@@ -1,10 +1,10 @@
1# Whitespace 1# Leerraum
2 2
3YueScript 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. 3YueScript ist eine whitespace-sensible Sprache. Du musst bestimmte Code-Blöcke mit derselben Einrückung (Leerzeichen **' '** oder Tab **'\t'**) schreiben, z. B. Funktionskörper, Wertelisten und Kontrollblöcke. Ausdrücke mit unterschiedlichem Leerraum können unterschiedliche Bedeutungen haben. Ein Tab wird wie 4 Leerzeichen behandelt, aber es ist besser, Leerzeichen und Tabs nicht zu mischen.
4 4
5## Statement Separator 5## Anweisungs-Trenner
6 6
7A statement normally ends at a line break. You can also use a semicolon `;` to explicitly terminate a statement, which allows writing multiple statements on the same line: 7Eine Anweisung endet normalerweise an einem Zeilenumbruch. Du kannst auch ein Semikolon `;` verwenden, um eine Anweisung explizit zu beenden, wodurch mehrere Anweisungen in einer Zeile möglich sind:
8 8
9```yuescript 9```yuescript
10a = 1; b = 2; print a + b 10a = 1; b = 2; print a + b
@@ -17,9 +17,9 @@ a = 1; b = 2; print a + b
17 17
18</YueDisplay> 18</YueDisplay>
19 19
20## Multiline Chaining 20## Mehrzeiliges Chaining
21 21
22You can write multi-line chaining function calls with a same indent. 22Du kannst mehrzeilige, verkettete Funktionsaufrufe mit derselben Einrückung schreiben.
23 23
24```yuescript 24```yuescript
25Rx.Observable 25Rx.Observable
diff --git a/doc/docs/de/doc/objects/object-oriented-programming.md b/doc/docs/de/doc/objects/object-oriented-programming.md
index 6a8559e..1c116a3 100644
--- a/doc/docs/de/doc/objects/object-oriented-programming.md
+++ b/doc/docs/de/doc/objects/object-oriented-programming.md
@@ -1,8 +1,8 @@
1# Object Oriented Programming 1# Objektorientierte Programmierung
2 2
3In 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. 3In diesen Beispielen kann der generierte Lua-Code überwältigend wirken. Am besten konzentrierst du dich zunächst auf die Bedeutung des YueScript-Codes und schaust dir den Lua-Code nur an, wenn du die Implementierungsdetails wissen möchtest.
4 4
5A simple class: 5Eine einfache Klasse:
6 6
7```yuescript 7```yuescript
8class Inventory 8class Inventory
@@ -31,36 +31,36 @@ class Inventory
31 31
32</YueDisplay> 32</YueDisplay>
33 33
34A class is declared with a class statement followed by a table-like declaration where all of the methods and properties are listed. 34Eine Klasse wird mit einem `class`-Statement deklariert, gefolgt von einer tabellenähnlichen Deklaration mit allen Methoden und Eigenschaften.
35 35
36The new property is special in that it will become the constructor. 36Die Eigenschaft `new` ist besonders, da sie zum Konstruktor wird.
37 37
38Notice how all the methods in the class use the fat arrow function syntax. When calling methods on a instance, the instance itself is sent in as the first argument. The fat arrow handles the creation of a self argument. 38Beachte, dass alle Methoden in der Klasse die Fat-Arrow-Syntax verwenden. Beim Aufruf von Methoden auf einer Instanz wird die Instanz selbst als erstes Argument übergeben. Der Fat-Arrow übernimmt die Erstellung des `self`-Arguments.
39 39
40The @ prefix on a variable name is shorthand for self.. @items becomes self.items. 40Das `@`-Präfix ist Kurzform für `self.`. `@items` wird zu `self.items`.
41 41
42Creating an instance of the class is done by calling the name of the class as a function. 42Eine Instanz der Klasse wird erstellt, indem man den Klassennamen wie eine Funktion aufruft.
43 43
44```yuescript 44```yuescript
45inv = Inventory! 45inv = Inventory!
46inv\add_item "t-shirt" 46inv\add_item "T-Shirt"
47inv\add_item "pants" 47inv\add_item "Hose"
48``` 48```
49<YueDisplay> 49<YueDisplay>
50 50
51```yue 51```yue
52inv = Inventory! 52inv = Inventory!
53inv\add_item "t-shirt" 53inv\add_item "T-Shirt"
54inv\add_item "pants" 54inv\add_item "Hose"
55``` 55```
56 56
57</YueDisplay> 57</YueDisplay>
58 58
59Because the instance of the class needs to be sent to the methods when they are called, the \ operator is used. 59Da die Instanz bei Methodenaufrufen an die Methoden übergeben werden muss, wird der `\`-Operator verwendet.
60 60
61All properties of a class are shared among the instances. This is fine for functions, but for other types of objects, undesired results may occur. 61Alle Eigenschaften einer Klasse werden von allen Instanzen gemeinsam genutzt. Für Funktionen ist das ok, aber bei anderen Objekten kann das zu unerwünschten Ergebnissen führen.
62 62
63Consider the example below, the clothes property is shared amongst all instances, so modifications to it in one instance will show up in another: 63Im folgenden Beispiel wird die Eigenschaft `clothes` von allen Instanzen geteilt, sodass Änderungen in einer Instanz in einer anderen sichtbar werden:
64 64
65```yuescript 65```yuescript
66class Person 66class Person
@@ -71,10 +71,10 @@ class Person
71a = Person! 71a = Person!
72b = Person! 72b = Person!
73 73
74a\give_item "pants" 74a\give_item "Hose"
75b\give_item "shirt" 75b\give_item "Hemd"
76 76
77-- will print both pants and shirt 77-- gibt sowohl Hose als auch Hemd aus
78print item for item in *a.clothes 78print item for item in *a.clothes
79``` 79```
80<YueDisplay> 80<YueDisplay>
@@ -88,16 +88,16 @@ class Person
88a = Person! 88a = Person!
89b = Person! 89b = Person!
90 90
91a\give_item "pants" 91a\give_item "Hose"
92b\give_item "shirt" 92b\give_item "Hemd"
93 93
94-- will print both pants and shirt 94-- gibt sowohl Hose als auch Hemd aus
95print item for item in *a.clothes 95print item for item in *a.clothes
96``` 96```
97 97
98</YueDisplay> 98</YueDisplay>
99 99
100The proper way to avoid this problem is to create the mutable state of the object in the constructor: 100Der richtige Weg, das zu vermeiden, ist, den veränderlichen Zustand im Konstruktor zu erstellen:
101 101
102```yuescript 102```yuescript
103class Person 103class Person
@@ -114,15 +114,15 @@ class Person
114 114
115</YueDisplay> 115</YueDisplay>
116 116
117## Inheritance 117## Vererbung
118 118
119The extends keyword can be used in a class declaration to inherit the properties and methods from another class. 119Das Schlüsselwort `extends` kann in einer Klassendeklaration verwendet werden, um Eigenschaften und Methoden von einer anderen Klasse zu erben.
120 120
121```yuescript 121```yuescript
122class BackPack extends Inventory 122class BackPack extends Inventory
123 size: 10 123 size: 10
124 add_item: (name) => 124 add_item: (name) =>
125 if #@items > size then error "backpack is full" 125 if #@items > size then error "Rucksack ist voll"
126 super name 126 super name
127``` 127```
128<YueDisplay> 128<YueDisplay>
@@ -131,24 +131,24 @@ class BackPack extends Inventory
131class BackPack extends Inventory 131class BackPack extends Inventory
132 size: 10 132 size: 10
133 add_item: (name) => 133 add_item: (name) =>
134 if #@items > size then error "backpack is full" 134 if #@items > size then error "Rucksack ist voll"
135 super name 135 super name
136``` 136```
137 137
138</YueDisplay> 138</YueDisplay>
139 139
140Here we extend our Inventory class, and limit the amount of items it can carry. 140Hier erweitern wir unsere `Inventory`-Klasse und begrenzen die Anzahl der Elemente.
141 141
142In this example, we don't define a constructor on the subclass, so the parent class' constructor is called when we make a new instance. If we did define a constructor then we can use the super method to call the parent constructor. 142In diesem Beispiel definieren wir keinen Konstruktor in der Subklasse, daher wird der Konstruktor der Elternklasse beim Erstellen einer neuen Instanz aufgerufen. Definieren wir einen Konstruktor, können wir mit `super` den Elternkonstruktor aufrufen.
143 143
144Whenever a class inherits from another, it sends a message to the parent class by calling the method __inherited on the parent class if it exists. The function receives two arguments, the class that is being inherited and the child class. 144Wenn eine Klasse von einer anderen erbt, sendet sie eine Nachricht an die Elternklasse, indem die Methode `__inherited` der Elternklasse aufgerufen wird, falls vorhanden. Die Funktion erhält zwei Argumente: die Klasse, die vererbt wird, und die Kindklasse.
145 145
146```yuescript 146```yuescript
147class Shelf 147class Shelf
148 @__inherited: (child) => 148 @__inherited: (child) =>
149 print @__name, "was inherited by", child.__name 149 print @__name, "wurde vererbt von", child.__name
150 150
151-- will print: Shelf was inherited by Cupboard 151-- gibt aus: Shelf wurde von Cupboard geerbt
152class Cupboard extends Shelf 152class Cupboard extends Shelf
153``` 153```
154<YueDisplay> 154<YueDisplay>
@@ -156,9 +156,9 @@ class Cupboard extends Shelf
156```yue 156```yue
157class Shelf 157class Shelf
158 @__inherited: (child) => 158 @__inherited: (child) =>
159 print @__name, "was inherited by", child.__name 159 print @__name, "wurde vererbt von", child.__name
160 160
161-- will print: Shelf was inherited by Cupboard 161-- gibt aus: Shelf wurde von Cupboard geerbt
162class Cupboard extends Shelf 162class Cupboard extends Shelf
163``` 163```
164 164
@@ -166,27 +166,27 @@ class Cupboard extends Shelf
166 166
167## Super 167## Super
168 168
169**super** is a special keyword that can be used in two different ways: It can be treated as an object, or it can be called like a function. It only has special functionality when inside a class. 169**super** ist ein spezielles Schlüsselwort, das auf zwei Arten verwendet werden kann: als Objekt oder als Funktionsaufruf. Es hat besondere Funktionalität nur innerhalb einer Klasse.
170 170
171When called as a function, it will call the function of the same name in the parent class. The current self will automatically be passed as the first argument. (As seen in the inheritance example above) 171Wenn es als Funktion aufgerufen wird, ruft es die gleichnamige Funktion in der Elternklasse auf. `self` wird automatisch als erstes Argument übergeben (wie im Vererbungsbeispiel oben).
172 172
173When super is used as a normal value, it is a reference to the parent class object. 173Wenn `super` als normaler Wert verwendet wird, ist es eine Referenz auf das Objekt der Elternklasse.
174 174
175It can be accessed like any of object in order to retrieve values in the parent class that might have been shadowed by the child class. 175Du kannst es wie jedes andere Objekt verwenden, um Werte der Elternklasse zu lesen, die von der Kindklasse überschattet wurden.
176 176
177When the \ calling operator is used with super, self is inserted as the first argument instead of the value of super itself. When using . to retrieve a function, the raw function is returned. 177Wenn der `\`-Aufrufoperator mit `super` verwendet wird, wird `self` als erstes Argument eingefügt statt des Wertes von `super`. Wenn man `.` zum Abrufen einer Funktion verwendet, wird die rohe Funktion zurückgegeben.
178 178
179A few examples of using super in different ways: 179Ein paar Beispiele für `super` in unterschiedlichen Formen:
180 180
181```yuescript 181```yuescript
182class MyClass extends ParentClass 182class MyClass extends ParentClass
183 a_method: => 183 a_method: =>
184 -- the following have the same effect: 184 -- Folgendes hat dieselbe Wirkung:
185 super "hello", "world" 185 super "hallo", "Welt"
186 super\a_method "hello", "world" 186 super\a_method "hallo", "Welt"
187 super.a_method self, "hello", "world" 187 super.a_method self, "hallo", "Welt"
188 188
189 -- super as a value is equal to the parent class: 189 -- super als Wert entspricht der Elternklasse:
190 assert super == ParentClass 190 assert super == ParentClass
191``` 191```
192<YueDisplay> 192<YueDisplay>
@@ -194,28 +194,28 @@ class MyClass extends ParentClass
194```yue 194```yue
195class MyClass extends ParentClass 195class MyClass extends ParentClass
196 a_method: => 196 a_method: =>
197 -- the following have the same effect: 197 -- Folgendes hat dieselbe Wirkung:
198 super "hello", "world" 198 super "hallo", "Welt"
199 super\a_method "hello", "world" 199 super\a_method "hallo", "Welt"
200 super.a_method self, "hello", "world" 200 super.a_method self, "hallo", "Welt"
201 201
202 -- super as a value is equal to the parent class: 202 -- super als Wert entspricht der Elternklasse:
203 assert super == ParentClass 203 assert super == ParentClass
204``` 204```
205 205
206</YueDisplay> 206</YueDisplay>
207 207
208**super** can also be used on left side of a Function Stub. The only major difference is that instead of the resulting function being bound to the value of super, it is bound to self. 208**super** kann auch links einer Funktions-Stub verwendet werden. Der einzige große Unterschied ist, dass die resultierende Funktion statt an `super` an `self` gebunden wird.
209 209
210## Types 210## Typen
211 211
212Every instance of a class carries its type with it. This is stored in the special __class property. This property holds the class object. The class object is what we call to build a new instance. We can also index the class object to retrieve class methods and properties. 212Jede Instanz einer Klasse trägt ihren Typ in sich. Dieser wird in der speziellen Eigenschaft `__class` gespeichert. Diese Eigenschaft enthält das Klassenobjekt. Das Klassenobjekt wird aufgerufen, um eine neue Instanz zu erstellen. Wir können das Klassenobjekt auch indizieren, um Klassenmethoden und Eigenschaften abzurufen.
213 213
214```yuescript 214```yuescript
215b = BackPack! 215b = BackPack!
216assert b.__class == BackPack 216assert b.__class == BackPack
217 217
218print BackPack.size -- prints 10 218print BackPack.size -- gibt 10 aus
219``` 219```
220<YueDisplay> 220<YueDisplay>
221 221
@@ -223,70 +223,70 @@ print BackPack.size -- prints 10
223b = BackPack! 223b = BackPack!
224assert b.__class == BackPack 224assert b.__class == BackPack
225 225
226print BackPack.size -- prints 10 226print BackPack.size -- gibt 10 aus
227``` 227```
228 228
229</YueDisplay> 229</YueDisplay>
230 230
231## Class Objects 231## Klassenobjekte
232 232
233The class object is what we create when we use a class statement. The class object is stored in a variable of the same name of the class. 233Das Klassenobjekt entsteht, wenn wir ein `class`-Statement verwenden. Es wird in einer Variablen mit dem Klassennamen gespeichert.
234 234
235The class object can be called like a function in order to create new instances. That's how we created instances of classes in the examples above. 235Das Klassenobjekt kann wie eine Funktion aufgerufen werden, um neue Instanzen zu erstellen. So haben wir die Instanzen in den Beispielen oben erstellt.
236 236
237A class is made up of two tables. The class table itself, and the base table. The base is used as the metatable for all the instances. All properties listed in the class declaration are placed in the base. 237Eine Klasse besteht aus zwei Tabellen: der Klassentabelle selbst und der Basistabelle. Die Basis wird als Metatable für alle Instanzen verwendet. Alle in der Klassendeklaration aufgeführten Eigenschaften werden in der Basis platziert.
238 238
239The class object's metatable reads properties from the base if they don't exist in the class object. This means we can access functions and properties directly from the class. 239Das Metatable des Klassenobjekts liest Eigenschaften aus der Basis, wenn sie im Klassenobjekt nicht existieren. Das bedeutet, dass wir Funktionen und Eigenschaften direkt von der Klasse aus aufrufen können.
240 240
241It is important to note that assigning to the class object does not assign into the base, so it's not a valid way to add new methods to instances. Instead the base must explicitly be changed. See the __base field below. 241Wichtig: Zuweisungen an das Klassenobjekt schreiben nicht in die Basis. Das ist keine gültige Methode, um neue Methoden zu Instanzen hinzuzufügen. Stattdessen muss die Basis explizit geändert werden. Siehe das Feld `__base` unten.
242 242
243The class object has a couple special properties: 243Das Klassenobjekt hat einige spezielle Eigenschaften:
244 244
245The name of the class as when it was declared is stored as a string in the __name field of the class object. 245Der Name der Klasse, wie sie deklariert wurde, wird im Feld `__name` gespeichert.
246 246
247```yuescript 247```yuescript
248print BackPack.__name -- prints Backpack 248print BackPack.__name -- gibt Backpack aus
249``` 249```
250<YueDisplay> 250<YueDisplay>
251 251
252```yue 252```yue
253print BackPack.__name -- prints Backpack 253print BackPack.__name -- gibt Backpack aus
254``` 254```
255 255
256</YueDisplay> 256</YueDisplay>
257 257
258The base object is stored in __base. We can modify this table to add functionality to instances that have already been created and ones that are yet to be created. 258Die Basistabelle ist in `__base` gespeichert. Du kannst diese Tabelle ändern, um Instanzen Funktionalität hinzuzufügen, die bereits existieren oder noch erstellt werden.
259 259
260If the class extends from anything, the parent class object is stored in __parent. 260Wenn die Klasse von etwas erbt, ist das Elternklassenobjekt in `__parent` gespeichert.
261 261
262## Class Variables 262## Klassenvariablen
263 263
264We can create variables directly in the class object instead of in the base by using @ in the front of the property name in a class declaration. 264Du kannst Variablen direkt im Klassenobjekt statt in der Basis erstellen, indem du in der Klassendeklaration `@` vor den Eigenschaftsnamen setzt.
265 265
266```yuescript 266```yuescript
267class Things 267class Things
268 @some_func: => print "Hello from", @__name 268 @some_func: => print "Hallo von", @__name
269 269
270Things\some_func! 270Things\some_func!
271 271
272-- class variables not visible in instances 272-- Klassenvariablen in Instanzen nicht sichtbar
273assert Things().some_func == nil 273assert Things().some_func == nil
274``` 274```
275<YueDisplay> 275<YueDisplay>
276 276
277```yue 277```yue
278class Things 278class Things
279 @some_func: => print "Hello from", @__name 279 @some_func: => print "Hallo von", @__name
280 280
281Things\some_func! 281Things\some_func!
282 282
283-- class variables not visible in instances 283-- Klassenvariablen in Instanzen nicht sichtbar
284assert Things().some_func == nil 284assert Things().some_func == nil
285``` 285```
286 286
287</YueDisplay> 287</YueDisplay>
288 288
289In expressions, we can use @@ to access a value that is stored in the __class of self. Thus, @@hello is shorthand for self.__class.hello. 289In Ausdrücken können wir `@@` verwenden, um auf einen Wert zuzugreifen, der in `self.__class` gespeichert ist. `@@hello` ist also eine Kurzform für `self.__class.hello`.
290 290
291```yuescript 291```yuescript
292class Counter 292class Counter
@@ -298,7 +298,7 @@ class Counter
298Counter! 298Counter!
299Counter! 299Counter!
300 300
301print Counter.count -- prints 2 301print Counter.count -- gibt 2 aus
302``` 302```
303<YueDisplay> 303<YueDisplay>
304 304
@@ -312,12 +312,12 @@ class Counter
312Counter! 312Counter!
313Counter! 313Counter!
314 314
315print Counter.count -- prints 2 315print Counter.count -- gibt 2 aus
316``` 316```
317 317
318</YueDisplay> 318</YueDisplay>
319 319
320The calling semantics of @@ are similar to @. Calling a @@ name will pass the class in as the first argument using Lua's colon syntax. 320Die Aufrufsemantik von `@@` ist ähnlich wie bei `@`. Wenn du einen `@@`-Namen aufrufst, wird die Klasse als erstes Argument übergeben (Lua-`:`-Syntax).
321 321
322```yuescript 322```yuescript
323@@hello 1,2,3,4 323@@hello 1,2,3,4
@@ -330,28 +330,28 @@ The calling semantics of @@ are similar to @. Calling a @@ name will pass the cl
330 330
331</YueDisplay> 331</YueDisplay>
332 332
333## Class Declaration Statements 333## Klassendeklarations-Statements
334 334
335In the body of a class declaration, we can have normal expressions in addition to key/value pairs. In this context, self is equal to the class object. 335Im Rumpf einer Klassendeklaration können wir normale Ausdrücke zusätzlich zu Schlüssel/Wert-Paaren haben. In diesem Kontext ist `self` gleich dem Klassenobjekt.
336 336
337Here is an alternative way to create a class variable compared to what's described above: 337Hier ist eine alternative Möglichkeit, eine Klassenvariable zu erstellen:
338 338
339```yuescript 339```yuescript
340class Things 340class Things
341 @class_var = "hello world" 341 @class_var = "Hallo Welt"
342``` 342```
343<YueDisplay> 343<YueDisplay>
344 344
345```yue 345```yue
346class Things 346class Things
347 @class_var = "hello world" 347 @class_var = "Hallo Welt"
348``` 348```
349 349
350</YueDisplay> 350</YueDisplay>
351 351
352These expressions are executed after all the properties have been added to the base. 352Diese Ausdrücke werden ausgeführt, nachdem alle Eigenschaften zur Basis hinzugefügt wurden.
353 353
354All variables declared in the body of the class are local to the classes properties. This is convenient for placing private values or helper functions that only the class methods can access: 354Alle Variablen, die im Klassenkörper deklariert werden, sind lokal zu den Klasseneigenschaften. Das ist praktisch, um private Werte oder Hilfsfunktionen zu platzieren, auf die nur die Klassenmethoden zugreifen können:
355 355
356```yuescript 356```yuescript
357class MoreThings 357class MoreThings
@@ -359,7 +359,7 @@ class MoreThings
359 log = (msg) -> print "LOG:", msg 359 log = (msg) -> print "LOG:", msg
360 360
361 some_method: => 361 some_method: =>
362 log "hello world: " .. secret 362 log "Hallo Welt: " .. secret
363``` 363```
364<YueDisplay> 364<YueDisplay>
365 365
@@ -369,16 +369,16 @@ class MoreThings
369 log = (msg) -> print "LOG:", msg 369 log = (msg) -> print "LOG:", msg
370 370
371 some_method: => 371 some_method: =>
372 log "hello world: " .. secret 372 log "Hallo Welt: " .. secret
373``` 373```
374 374
375</YueDisplay> 375</YueDisplay>
376 376
377## @ and @@ Values 377## @- und @@-Werte
378 378
379When @ and @@ are prefixed in front of a name they represent, respectively, that name accessed in self and self.__class. 379Wenn `@` und `@@` vor einem Namen stehen, repräsentieren sie den Namen in `self` bzw. `self.__class`.
380 380
381If they are used all by themselves, they are aliases for self and self.__class. 381Wenn sie alleine verwendet werden, sind sie Aliase für `self` und `self.__class`.
382 382
383```yuescript 383```yuescript
384assert @ == self 384assert @ == self
@@ -393,7 +393,7 @@ assert @@ == self.__class
393 393
394</YueDisplay> 394</YueDisplay>
395 395
396For example, a quick way to create a new instance of the same class from an instance method using @@: 396Zum Beispiel kannst du mit `@@` in einer Instanzmethode schnell eine neue Instanz derselben Klasse erzeugen:
397 397
398```yuescript 398```yuescript
399some_instance_method = (...) => @@ ... 399some_instance_method = (...) => @@ ...
@@ -406,15 +406,15 @@ some_instance_method = (...) => @@ ...
406 406
407</YueDisplay> 407</YueDisplay>
408 408
409## Constructor Property Promotion 409## Konstruktor-Property-Promotion
410 410
411To reduce the boilerplate code for definition of simple value objects. You can write a simple class like: 411Um Boilerplate beim Definieren einfacher Value-Objekte zu reduzieren, kannst du eine Klasse so schreiben:
412 412
413```yuescript 413```yuescript
414class Something 414class Something
415 new: (@foo, @bar, @@biz, @@baz) => 415 new: (@foo, @bar, @@biz, @@baz) =>
416 416
417-- Which is short for 417-- Kurzform für
418 418
419class Something 419class Something
420 new: (foo, bar, biz, baz) => 420 new: (foo, bar, biz, baz) =>
@@ -429,7 +429,7 @@ class Something
429class Something 429class Something
430 new: (@foo, @bar, @@biz, @@baz) => 430 new: (@foo, @bar, @@biz, @@baz) =>
431 431
432-- Which is short for 432-- Kurzform für
433 433
434class Something 434class Something
435 new: (foo, bar, biz, baz) => 435 new: (foo, bar, biz, baz) =>
@@ -441,7 +441,7 @@ class Something
441 441
442</YueDisplay> 442</YueDisplay>
443 443
444You can also use this syntax for a common function to initialize a object's fields. 444Du kannst diese Syntax auch für eine gemeinsame Funktion verwenden, um Objektfelder zu initialisieren.
445 445
446```yuescript 446```yuescript
447new = (@fieldA, @fieldB) => @ 447new = (@fieldA, @fieldB) => @
@@ -458,9 +458,9 @@ print obj
458 458
459</YueDisplay> 459</YueDisplay>
460 460
461## Class Expressions 461## Klassenausdrücke
462 462
463The class syntax can also be used as an expression which can be assigned to a variable or explicitly returned. 463Die `class`-Syntax kann auch als Ausdruck verwendet werden, der einer Variable zugewiesen oder explizit zurückgegeben wird.
464 464
465```yuescript 465```yuescript
466x = class Bucket 466x = class Bucket
@@ -477,9 +477,9 @@ x = class Bucket
477 477
478</YueDisplay> 478</YueDisplay>
479 479
480## Anonymous classes 480## Anonyme Klassen
481 481
482The name can be left out when declaring a class. The __name attribute will be nil, unless the class expression is in an assignment. The name on the left hand side of the assignment is used instead of nil. 482Der Name kann beim Deklarieren einer Klasse weggelassen werden. Das `__name`-Attribut ist dann `nil`, es sei denn, der Klassenausdruck steht in einer Zuweisung. In diesem Fall wird der Name auf der linken Seite statt `nil` verwendet.
483 483
484```yuescript 484```yuescript
485BigBucket = class extends Bucket 485BigBucket = class extends Bucket
@@ -498,7 +498,7 @@ assert Bucket.__name == "BigBucket"
498 498
499</YueDisplay> 499</YueDisplay>
500 500
501You can even leave off the body, meaning you can write a blank anonymous class like this: 501Du kannst sogar den Körper weglassen und eine leere anonyme Klasse schreiben:
502 502
503```yuescript 503```yuescript
504x = class 504x = class
@@ -513,7 +513,7 @@ x = class
513 513
514## Class Mixing 514## Class Mixing
515 515
516You can do mixing with keyword `using` to copy functions from either a plain table or a predefined class object into your new class. When doing mixing with a plain table, you can override the class indexing function (metamethod `__index`) to your customized implementation. When doing mixing with an existing class object, the class object's metamethods won't be copied. 516Du kannst mit dem Schlüsselwort `using` mischen, um Funktionen aus einer einfachen Tabelle oder einem vordefinierten Klassenobjekt in deine neue Klasse zu kopieren. Beim Mischen mit einer einfachen Tabelle kannst du die Klassen-Indexing-Funktion (Metamethod `__index`) überschreiben. Beim Mischen mit einem bestehenden Klassenobjekt werden dessen Metamethoden nicht kopiert.
517 517
518```yuescript 518```yuescript
519MyIndex = __index: var: 1 519MyIndex = __index: var: 1
@@ -530,7 +530,7 @@ class Y using X
530y = Y! 530y = Y!
531y\func! 531y\func!
532 532
533assert y.__class.__parent ~= X -- X is not parent of Y 533assert y.__class.__parent ~= X -- X ist nicht die Elternklasse von Y
534``` 534```
535<YueDisplay> 535<YueDisplay>
536 536
@@ -549,7 +549,7 @@ class Y using X
549y = Y! 549y = Y!
550y\func! 550y\func!
551 551
552assert y.__class.__parent ~= X -- X is not parent of Y 552assert y.__class.__parent ~= X -- X ist nicht die Elternklasse von Y
553``` 553```
554 554
555</YueDisplay> 555</YueDisplay>
diff --git a/doc/docs/de/doc/objects/with-statement.md b/doc/docs/de/doc/objects/with-statement.md
index 7786803..446f837 100644
--- a/doc/docs/de/doc/objects/with-statement.md
+++ b/doc/docs/de/doc/objects/with-statement.md
@@ -1,13 +1,12 @@
1# With Statement 1# With-Statement
2 2
3Ein häufiges Muster bei der Erstellung eines Objekts ist, unmittelbar danach eine Reihe von Funktionen aufzurufen und Eigenschaften zu setzen.
3 4
4A common pattern involving the creation of an object is calling a series of functions and setting a series of properties immediately after creating it. 5Das führt dazu, dass der Objektname mehrfach wiederholt wird und unnötiges Rauschen entsteht. Eine gängige Lösung ist, eine Tabelle als Argument zu übergeben, die eine Sammlung von Schlüsseln und Werten enthält, die überschrieben werden sollen. Der Nachteil ist, dass der Konstruktor dieses Objekts diese Form unterstützen muss.
5 6
6This results in repeating the name of the object multiple times in code, adding unnecessary noise. A common solution to this is to pass a table in as an argument which contains a collection of keys and values to overwrite. The downside to this is that the constructor of this object must support this form. 7Der `with`-Block hilft, das zu vermeiden. Innerhalb eines `with`-Blocks können wir spezielle Anweisungen verwenden, die mit `.` oder `\` beginnen und die Operationen auf das Objekt anwenden, mit dem wir gerade arbeiten.
7 8
8The with block helps to alleviate this. Within a with block we can use a special statements that begin with either . or \ which represent those operations applied to the object we are using with on. 9Zum Beispiel arbeiten wir mit einem neu erstellten Objekt:
9
10For example, we work with a newly created object:
11 10
12```yuescript 11```yuescript
13with Person! 12with Person!
@@ -28,22 +27,22 @@ with Person!
28 27
29</YueDisplay> 28</YueDisplay>
30 29
31The with statement can also be used as an expression which returns the value it has been giving access to. 30Das `with`-Statement kann auch als Ausdruck verwendet werden und gibt den Wert zurück, auf den es Zugriff gewährt.
32 31
33```yuescript 32```yuescript
34file = with File "favorite_foods.txt" 33file = with File "Lieblingsessen.txt"
35 \set_encoding "utf8" 34 \set_encoding "utf8"
36``` 35```
37<YueDisplay> 36<YueDisplay>
38 37
39```yue 38```yue
40file = with File "favorite_foods.txt" 39file = with File "Lieblingsessen.txt"
41 \set_encoding "utf8" 40 \set_encoding "utf8"
42``` 41```
43 42
44</YueDisplay> 43</YueDisplay>
45 44
46Or… 45Oder
47 46
48```yuescript 47```yuescript
49create_person = (name, relatives) -> 48create_person = (name, relatives) ->
@@ -66,26 +65,26 @@ me = create_person "Leaf", [dad, mother, sister]
66 65
67</YueDisplay> 66</YueDisplay>
68 67
69In this usage, with can be seen as a special form of the K combinator. 68In dieser Verwendung kann `with` als spezielle Form des K-Kombinators gesehen werden.
70 69
71The expression in the with statement can also be an assignment, if you want to give a name to the expression. 70Der Ausdruck im `with`-Statement kann auch eine Zuweisung sein, wenn du dem Ausdruck einen Namen geben willst.
72 71
73```yuescript 72```yuescript
74with str := "Hello" 73with str := "Hallo"
75 print "original:", str 74 print "Original:", str
76 print "upper:", \upper! 75 print "Großbuchstaben:", \upper!
77``` 76```
78<YueDisplay> 77<YueDisplay>
79 78
80```yue 79```yue
81with str := "Hello" 80with str := "Hallo"
82 print "original:", str 81 print "Original:", str
83 print "upper:", \upper! 82 print "Großbuchstaben:", \upper!
84``` 83```
85 84
86</YueDisplay> 85</YueDisplay>
87 86
88You can access special keys with `[]` in a `with` statement. 87Du kannst in einem `with`-Statement über `[]` auf spezielle Schlüssel zugreifen.
89 88
90```yuescript 89```yuescript
91with tb 90with tb
@@ -94,7 +93,7 @@ with tb
94 with [abc] 93 with [abc]
95 [3] = [2]\func! 94 [3] = [2]\func!
96 ["key-name"] = value 95 ["key-name"] = value
97 [] = "abc" -- appending to "tb" 96 [] = "abc" -- an "tb" anhängen
98``` 97```
99<YueDisplay> 98<YueDisplay>
100 99
@@ -105,12 +104,12 @@ with tb
105 with [abc] 104 with [abc]
106 [3] = [2]\func! 105 [3] = [2]\func!
107 ["key-name"] = value 106 ["key-name"] = value
108 [] = "abc" -- appending to "tb" 107 [] = "abc" -- an "tb" anhängen
109``` 108```
110 109
111</YueDisplay> 110</YueDisplay>
112 111
113`with?` is an enhanced version of `with` syntax, which introduces an existential check to safely access objects that may be nil without explicit null checks. 112`with?` ist eine erweiterte Version der `with`-Syntax, die einen Existenz-Check einführt, um Objekte, die `nil` sein könnten, sicher zuzugreifen, ohne explizite Nullprüfungen.
114 113
115```yuescript 114```yuescript
116with? obj 115with? obj
diff --git a/doc/docs/de/doc/reference/license-mit.md b/doc/docs/de/doc/reference/license-mit.md
index f1d5d60..a5e9f70 100644
--- a/doc/docs/de/doc/reference/license-mit.md
+++ b/doc/docs/de/doc/reference/license-mit.md
@@ -1,23 +1,11 @@
1# License: MIT 1# Lizenz: MIT
2 2
3Copyright (c) 2017-2026 Li Jin \<dragon-fly@qq.com\> 3Hinweis: Die MIT-Lizenz ist unten im englischen Originaltext wiedergegeben.
4 4
5Permission is hereby granted, free of charge, to any person obtaining a copy 5Urheberrecht (c) 2017-2026 Li Jin <dragon-fly@qq.com>
6of this software and associated documentation files (the "Software"), to deal
7in the Software without restriction, including without limitation the rights
8to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9copies of the Software, and to permit persons to whom the Software is
10furnished to do so, subject to the following conditions:
11 6
12The above copyright notice and this permission notice shall be included in all 7Hiermit wird unentgeltlich jeder Person, die eine Kopie dieser Software und der zugehörigen Dokumentationsdateien (die "Software") erhält, die Erlaubnis erteilt, uneingeschränkt mit der Software zu verfahren, einschließlich und ohne Beschränkung der Rechte, die Software zu benutzen, zu kopieren, zu verändern, zusammenzuführen, zu veröffentlichen, zu verbreiten, zu unterlizenzieren und/oder zu verkaufen, sowie Personen, denen die Software zur Verfügung gestellt wird, dies ebenfalls zu gestatten, unter den folgenden Bedingungen:
13copies or substantial portions of the Software.
14 8
15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 9Der obige Urheberrechtshinweis und dieser Genehmigungshinweis müssen in allen Kopien oder wesentlichen Teilen der Software enthalten sein.
16IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21SOFTWARE.
22 10
23<CompilerModal /> 11DIE SOFTWARE WIRD OHNE JEGLICHE AUSDRÜCKLICHE ODER STILLSCHWEIGENDE GARANTIE ZUR VERFÜGUNG GESTELLT, EINSCHLIESSLICH DER GARANTIEN DER MARKTGÄNGIGKEIT, DER EIGNUNG FÜR EINEN BESTIMMTEN ZWECK UND DER NICHTVERLETZUNG. IN KEINEM FALL SIND DIE AUTOREN ODER URHEBERRECHTSINHABER FÜR ANSPRÜCHE, SCHÄDEN ODER SONSTIGE HAFTUNGEN VERANTWORTLICH, SEI ES AUS EINEM VERTRAG, EINER UNERLAUBTEN HANDLUNG ODER ANDERWEITIG, DIE SICH AUS DER SOFTWARE ODER DER BENUTZUNG DER SOFTWARE ODER ANDEREN GESCHÄFTEN MIT DER SOFTWARE ERGEBEN ODER DAMIT IN ZUSAMMENHANG STEHEN.
diff --git a/doc/docs/de/doc/reference/the-yuescript-library.md b/doc/docs/de/doc/reference/the-yuescript-library.md
index 3761755..1838ced 100644
--- a/doc/docs/de/doc/reference/the-yuescript-library.md
+++ b/doc/docs/de/doc/reference/the-yuescript-library.md
@@ -1,61 +1,61 @@
1# The YueScript Library 1# Die YueScript-Bibliothek
2 2
3Access it by `local yue = require("yue")` in Lua. 3Zugriff in Lua über `local yue = require("yue")`.
4 4
5## yue 5## yue
6 6
7**Description:** 7**Beschreibung:**
8 8
9The YueScript language library. 9Die YueScript-Sprachbibliothek.
10 10
11### version 11### version
12 12
13**Type:** Field. 13**Typ:** Feld.
14 14
15**Description:** 15**Beschreibung:**
16 16
17The YueScript version. 17Die YueScript-Version.
18 18
19**Signature:** 19**Signatur:**
20```lua 20```lua
21version: string 21version: string
22``` 22```
23 23
24### dirsep 24### dirsep
25 25
26**Type:** Field. 26**Typ:** Feld.
27 27
28**Description:** 28**Beschreibung:**
29 29
30The file separator for the current platform. 30Der Dateitrennzeichen-String der aktuellen Plattform.
31 31
32**Signature:** 32**Signatur:**
33```lua 33```lua
34dirsep: string 34dirsep: string
35``` 35```
36 36
37### yue_compiled 37### yue_compiled
38 38
39**Type:** Field. 39**Typ:** Feld.
40 40
41**Description:** 41**Beschreibung:**
42 42
43The compiled module code cache. 43Der Cache für kompilierten Modulcode.
44 44
45**Signature:** 45**Signatur:**
46```lua 46```lua
47yue_compiled: {string: string} 47yue_compiled: {string: string}
48``` 48```
49 49
50### to_lua 50### to_lua
51 51
52**Type:** Function. 52**Typ:** Funktion.
53 53
54**Description:** 54**Beschreibung:**
55 55
56The YueScript compiling function. It compiles the YueScript code to Lua code. 56Die YueScript-Compilerfunktion. Sie kompiliert YueScript-Code zu Lua-Code.
57 57
58**Signature:** 58**Signatur:**
59```lua 59```lua
60to_lua: function(code: string, config?: Config): 60to_lua: function(code: string, config?: Config):
61 --[[codes]] string | nil, 61 --[[codes]] string | nil,
@@ -63,682 +63,682 @@ to_lua: function(code: string, config?: Config):
63 --[[globals]] {{string, integer, integer}} | nil 63 --[[globals]] {{string, integer, integer}} | nil
64``` 64```
65 65
66**Parameters:** 66**Parameter:**
67 67
68| Parameter | Type | Description | 68| Parameter | Typ | Beschreibung |
69| --- | --- | --- | 69| --- | --- | --- |
70| code | string | The YueScript code. | 70| code | string | Der YueScript-Code. |
71| config | Config | [Optional] The compiler options. | 71| config | Config | [Optional] Die Compiler-Optionen. |
72 72
73**Returns:** 73**Rückgabe:**
74 74
75| Return Type | Description | 75| Rückgabetyp | Beschreibung |
76| --- | --- | 76| --- | --- |
77| string \| nil | The compiled Lua code, or nil if the compilation failed. | 77| string \| nil | Der kompilierte Lua-Code oder `nil`, falls die Kompilierung fehlgeschlagen ist. |
78| string \| nil | The error message, or nil if the compilation succeeded. | 78| string \| nil | Die Fehlermeldung oder `nil`, falls die Kompilierung erfolgreich war. |
79| {{string, integer, integer}} \| nil | The global variables appearing in the code (with name, row and column), or nil if the compiler option `lint_global` is false. | 79| {{string, integer, integer}} \| nil | Die globalen Variablen im Code (mit Name, Zeile und Spalte) oder `nil`, wenn die Compiler-Option `lint_global` false ist. |
80 80
81### file_exist 81### file_exist
82 82
83**Type:** Function. 83**Typ:** Funktion.
84 84
85**Description:** 85**Beschreibung:**
86 86
87The source file existence checking function. Can be overridden to customize the behavior. 87Prüft, ob eine Quelldatei existiert. Kann überschrieben werden, um das Verhalten anzupassen.
88 88
89**Signature:** 89**Signatur:**
90```lua 90```lua
91file_exist: function(filename: string): boolean 91file_exist: function(filename: string): boolean
92``` 92```
93 93
94**Parameters:** 94**Parameter:**
95 95
96| Parameter | Type | Description | 96| Parameter | Typ | Beschreibung |
97| --- | --- | --- | 97| --- | --- | --- |
98| filename | string | The file name. | 98| filename | string | Der Dateiname. |
99 99
100**Returns:** 100**Rückgabe:**
101 101
102| Return Type | Description | 102| Rückgabetyp | Beschreibung |
103| --- | --- | 103| --- | --- |
104| boolean | Whether the file exists. | 104| boolean | Ob die Datei existiert. |
105 105
106### read_file 106### read_file
107 107
108**Type:** Function. 108**Typ:** Funktion.
109 109
110**Description:** 110**Beschreibung:**
111 111
112The source file reading function. Can be overridden to customize the behavior. 112Liest eine Quelldatei. Kann überschrieben werden, um das Verhalten anzupassen.
113 113
114**Signature:** 114**Signatur:**
115```lua 115```lua
116read_file: function(filename: string): string 116read_file: function(filename: string): string
117``` 117```
118 118
119**Parameters:** 119**Parameter:**
120 120
121| Parameter | Type | Description | 121| Parameter | Typ | Beschreibung |
122| --- | --- | --- | 122| --- | --- | --- |
123| filename | string | The file name. | 123| filename | string | Der Dateiname. |
124 124
125**Returns:** 125**Rückgabe:**
126 126
127| Return Type | Description | 127| Rückgabetyp | Beschreibung |
128| --- | --- | 128| --- | --- |
129| string | The file content. | 129| string | Der Dateiinhalt. |
130 130
131### insert_loader 131### insert_loader
132 132
133**Type:** Function. 133**Typ:** Funktion.
134 134
135**Description:** 135**Beschreibung:**
136 136
137Insert the YueScript loader to the package loaders (searchers). 137Fügt den YueScript-Loader in die Package-Loader (Searcher) ein.
138 138
139**Signature:** 139**Signatur:**
140```lua 140```lua
141insert_loader: function(pos?: integer): boolean 141insert_loader: function(pos?: integer): boolean
142``` 142```
143 143
144**Parameters:** 144**Parameter:**
145 145
146| Parameter | Type | Description | 146| Parameter | Typ | Beschreibung |
147| --- | --- | --- | 147| --- | --- | --- |
148| pos | integer | [Optional] The position to insert the loader. Default is 3. | 148| pos | integer | [Optional] Position, an der der Loader eingefügt wird. Standard ist 3. |
149 149
150**Returns:** 150**Rückgabe:**
151 151
152| Return Type | Description | 152| Rückgabetyp | Beschreibung |
153| --- | --- | 153| --- | --- |
154| boolean | Whether the loader is inserted successfully. It will fail if the loader is already inserted. | 154| boolean | Ob der Loader erfolgreich eingefügt wurde. Scheitert, wenn er bereits eingefügt ist. |
155 155
156### remove_loader 156### remove_loader
157 157
158**Type:** Function. 158**Typ:** Funktion.
159 159
160**Description:** 160**Beschreibung:**
161 161
162Remove the YueScript loader from the package loaders (searchers). 162Entfernt den YueScript-Loader aus den Package-Loadern (Searchern).
163 163
164**Signature:** 164**Signatur:**
165```lua 165```lua
166remove_loader: function(): boolean 166remove_loader: function(): boolean
167``` 167```
168 168
169**Returns:** 169**Rückgabe:**
170 170
171| Return Type | Description | 171| Rückgabetyp | Beschreibung |
172| --- | --- | 172| --- | --- |
173| boolean | Whether the loader is removed successfully. It will fail if the loader is not inserted. | 173| boolean | Ob der Loader erfolgreich entfernt wurde. Scheitert, wenn er nicht eingefügt ist. |
174 174
175### loadstring 175### loadstring
176 176
177**Type:** Function. 177**Typ:** Funktion.
178 178
179**Description:** 179**Beschreibung:**
180 180
181Loads YueScript code from a string into a function. 181Lädt YueScript-Code aus einem String in eine Funktion.
182 182
183**Signature:** 183**Signatur:**
184```lua 184```lua
185loadstring: function(input: string, chunkname: string, env: table, config?: Config): 185loadstring: function(input: string, chunkname: string, env: table, config?: Config):
186 --[[loaded function]] nil | function(...: any): (any...), 186 --[[loaded function]] nil | function(...: any): (any...),
187 --[[error]] string | nil 187 --[[error]] string | nil
188``` 188```
189 189
190**Parameters:** 190**Parameter:**
191 191
192| Parameter | Type | Description | 192| Parameter | Typ | Beschreibung |
193| --- | --- | --- | 193| --- | --- | --- |
194| input | string | The YueScript code. | 194| input | string | Der YueScript-Code. |
195| chunkname | string | The name of the code chunk. | 195| chunkname | string | Der Name des Code-Chunks. |
196| env | table | The environment table. | 196| env | table | Die Environment-Tabelle. |
197| config | Config | [Optional] The compiler options. | 197| config | Config | [Optional] Die Compiler-Optionen. |
198 198
199**Returns:** 199**Rückgabe:**
200 200
201| Return Type | Description | 201| Rückgabetyp | Beschreibung |
202| --- | --- | 202| --- | --- |
203| function \| nil | The loaded function, or nil if the loading failed. | 203| function \| nil | Die geladene Funktion oder `nil`, falls das Laden fehlgeschlagen ist. |
204| string \| nil | The error message, or nil if the loading succeeded. | 204| string \| nil | Die Fehlermeldung oder `nil`, falls das Laden erfolgreich war. |
205 205
206### loadstring 206### loadstring
207 207
208**Type:** Function. 208**Typ:** Funktion.
209 209
210**Description:** 210**Beschreibung:**
211 211
212Loads YueScript code from a string into a function. 212Lädt YueScript-Code aus einem String in eine Funktion.
213 213
214**Signature:** 214**Signatur:**
215```lua 215```lua
216loadstring: function(input: string, chunkname: string, config?: Config): 216loadstring: function(input: string, chunkname: string, config?: Config):
217 --[[loaded function]] nil | function(...: any): (any...), 217 --[[loaded function]] nil | function(...: any): (any...),
218 --[[error]] string | nil 218 --[[error]] string | nil
219``` 219```
220 220
221**Parameters:** 221**Parameter:**
222 222
223| Parameter | Type | Description | 223| Parameter | Typ | Beschreibung |
224| --- | --- | --- | 224| --- | --- | --- |
225| input | string | The YueScript code. | 225| input | string | Der YueScript-Code. |
226| chunkname | string | The name of the code chunk. | 226| chunkname | string | Der Name des Code-Chunks. |
227| config | Config | [Optional] The compiler options. | 227| config | Config | [Optional] Die Compiler-Optionen. |
228 228
229**Returns:** 229**Rückgabe:**
230 230
231| Return Type | Description | 231| Rückgabetyp | Beschreibung |
232| --- | --- | 232| --- | --- |
233| function \| nil | The loaded function, or nil if the loading failed. | 233| function \| nil | Die geladene Funktion oder `nil`, falls das Laden fehlgeschlagen ist. |
234| string \| nil | The error message, or nil if the loading succeeded. | 234| string \| nil | Die Fehlermeldung oder `nil`, falls das Laden erfolgreich war. |
235 235
236### loadstring 236### loadstring
237 237
238**Type:** Function. 238**Typ:** Funktion.
239 239
240**Description:** 240**Beschreibung:**
241 241
242Loads YueScript code from a string into a function. 242Lädt YueScript-Code aus einem String in eine Funktion.
243 243
244**Signature:** 244**Signatur:**
245```lua 245```lua
246loadstring: function(input: string, config?: Config): 246loadstring: function(input: string, config?: Config):
247 --[[loaded function]] nil | function(...: any): (any...), 247 --[[loaded function]] nil | function(...: any): (any...),
248 --[[error]] string | nil 248 --[[error]] string | nil
249``` 249```
250 250
251**Parameters:** 251**Parameter:**
252 252
253| Parameter | Type | Description | 253| Parameter | Typ | Beschreibung |
254| --- | --- | --- | 254| --- | --- | --- |
255| input | string | The YueScript code. | 255| input | string | Der YueScript-Code. |
256| config | Config | [Optional] The compiler options. | 256| config | Config | [Optional] Die Compiler-Optionen. |
257 257
258**Returns:** 258**Rückgabe:**
259 259
260| Return Type | Description | 260| Rückgabetyp | Beschreibung |
261| --- | --- | 261| --- | --- |
262| function \| nil | The loaded function, or nil if the loading failed. | 262| function \| nil | Die geladene Funktion oder `nil`, falls das Laden fehlgeschlagen ist. |
263| string \| nil | The error message, or nil if the loading succeeded. | 263| string \| nil | Die Fehlermeldung oder `nil`, falls das Laden erfolgreich war. |
264 264
265### loadfile 265### loadfile
266 266
267**Type:** Function. 267**Typ:** Funktion.
268 268
269**Description:** 269**Beschreibung:**
270 270
271Loads YueScript code from a file into a function. 271Lädt YueScript-Code aus einer Datei in eine Funktion.
272 272
273**Signature:** 273**Signatur:**
274```lua 274```lua
275loadfile: function(filename: string, env: table, config?: Config): 275loadfile: function(filename: string, env: table, config?: Config):
276 nil | function(...: any): (any...), 276 nil | function(...: any): (any...),
277 string | nil 277 string | nil
278``` 278```
279 279
280**Parameters:** 280**Parameter:**
281 281
282| Parameter | Type | Description | 282| Parameter | Typ | Beschreibung |
283| --- | --- | --- | 283| --- | --- | --- |
284| filename | string | The file name. | 284| filename | string | Der Dateiname. |
285| env | table | The environment table. | 285| env | table | Die Environment-Tabelle. |
286| config | Config | [Optional] The compiler options. | 286| config | Config | [Optional] Die Compiler-Optionen. |
287 287
288**Returns:** 288**Rückgabe:**
289 289
290| Return Type | Description | 290| Rückgabetyp | Beschreibung |
291| --- | --- | 291| --- | --- |
292| function \| nil | The loaded function, or nil if the loading failed. | 292| function \| nil | Die geladene Funktion oder `nil`, falls das Laden fehlgeschlagen ist. |
293| string \| nil | The error message, or nil if the loading succeeded. | 293| string \| nil | Die Fehlermeldung oder `nil`, falls das Laden erfolgreich war. |
294 294
295### loadfile 295### loadfile
296 296
297**Type:** Function. 297**Typ:** Funktion.
298 298
299**Description:** 299**Beschreibung:**
300 300
301Loads YueScript code from a file into a function. 301Lädt YueScript-Code aus einer Datei in eine Funktion.
302 302
303**Signature:** 303**Signatur:**
304```lua 304```lua
305loadfile: function(filename: string, config?: Config): 305loadfile: function(filename: string, config?: Config):
306 nil | function(...: any): (any...), 306 nil | function(...: any): (any...),
307 string | nil 307 string | nil
308``` 308```
309 309
310**Parameters:** 310**Parameter:**
311 311
312| Parameter | Type | Description | 312| Parameter | Typ | Beschreibung |
313| --- | --- | --- | 313| --- | --- | --- |
314| filename | string | The file name. | 314| filename | string | Der Dateiname. |
315| config | Config | [Optional] The compiler options. | 315| config | Config | [Optional] Die Compiler-Optionen. |
316 316
317**Returns:** 317**Rückgabe:**
318 318
319| Return Type | Description | 319| Rückgabetyp | Beschreibung |
320| --- | --- | 320| --- | --- |
321| function \| nil | The loaded function, or nil if the loading failed. | 321| function \| nil | Die geladene Funktion oder `nil`, falls das Laden fehlgeschlagen ist. |
322| string \| nil | The error message, or nil if the loading succeeded. | 322| string \| nil | Die Fehlermeldung oder `nil`, falls das Laden erfolgreich war. |
323 323
324### dofile 324### dofile
325 325
326**Type:** Function. 326**Typ:** Funktion.
327 327
328**Description:** 328**Beschreibung:**
329 329
330Loads YueScript code from a file into a function and executes it. 330Lädt YueScript-Code aus einer Datei in eine Funktion und führt sie aus.
331 331
332**Signature:** 332**Signatur:**
333```lua 333```lua
334dofile: function(filename: string, env: table, config?: Config): any... 334dofile: function(filename: string, env: table, config?: Config): any...
335``` 335```
336 336
337**Parameters:** 337**Parameter:**
338 338
339| Parameter | Type | Description | 339| Parameter | Typ | Beschreibung |
340| --- | --- | --- | 340| --- | --- | --- |
341| filename | string | The file name. | 341| filename | string | Der Dateiname. |
342| env | table | The environment table. | 342| env | table | Die Environment-Tabelle. |
343| config | Config | [Optional] The compiler options. | 343| config | Config | [Optional] Die Compiler-Optionen. |
344 344
345**Returns:** 345**Rückgabe:**
346 346
347| Return Type | Description | 347| Rückgabetyp | Beschreibung |
348| --- | --- | 348| --- | --- |
349| any... | The return values of the loaded function. | 349| any... | Die Rückgabewerte der geladenen Funktion. |
350 350
351### dofile 351### dofile
352 352
353**Type:** Function. 353**Typ:** Funktion.
354 354
355**Description:** 355**Beschreibung:**
356 356
357Loads YueScript code from a file into a function and executes it. 357Lädt YueScript-Code aus einer Datei in eine Funktion und führt sie aus.
358 358
359**Signature:** 359**Signatur:**
360```lua 360```lua
361dofile: function(filename: string, config?: Config): any... 361dofile: function(filename: string, config?: Config): any...
362``` 362```
363 363
364**Parameters:** 364**Parameter:**
365 365
366| Parameter | Type | Description | 366| Parameter | Typ | Beschreibung |
367| --- | --- | --- | 367| --- | --- | --- |
368| filename | string | The file name. | 368| filename | string | Der Dateiname. |
369| config | Config | [Optional] The compiler options. | 369| config | Config | [Optional] Die Compiler-Optionen. |
370 370
371**Returns:** 371**Rückgabe:**
372 372
373| Return Type | Description | 373| Rückgabetyp | Beschreibung |
374| --- | --- | 374| --- | --- |
375| any... | The return values of the loaded function. | 375| any... | Die Rückgabewerte der geladenen Funktion. |
376 376
377### find_modulepath 377### find_modulepath
378 378
379**Type:** Function. 379**Typ:** Funktion.
380 380
381**Description:** 381**Beschreibung:**
382 382
383Resolves the YueScript module name to the file path. 383st den YueScript-Modulnamen in einen Dateipfad auf.
384 384
385**Signature:** 385**Signatur:**
386```lua 386```lua
387find_modulepath: function(name: string): string 387find_modulepath: function(name: string): string
388``` 388```
389 389
390**Parameters:** 390**Parameter:**
391 391
392| Parameter | Type | Description | 392| Parameter | Typ | Beschreibung |
393| --- | --- | --- | 393| --- | --- | --- |
394| name | string | The module name. | 394| name | string | Der Modulname. |
395 395
396**Returns:** 396**Rückgabe:**
397 397
398| Return Type | Description | 398| Rückgabetyp | Beschreibung |
399| --- | --- | 399| --- | --- |
400| string | The file path. | 400| string | Der Dateipfad. |
401 401
402### pcall 402### pcall
403 403
404**Type:** Function. 404**Typ:** Funktion.
405 405
406**Description:** 406**Beschreibung:**
407 407
408Calls a function in protected mode. 408Ruft eine Funktion im gesctzten Modus auf.
409Catches any errors and returns a status code and results or error object. 409ngt Fehler ab und gibt einen Statuscode sowie Ergebnisse oder ein Fehlerobjekt zurück.
410Rewrites the error line number to the original line number in the YueScript code when errors occur. 410Schreibt die Fehlerzeilennummer bei Fehlern auf die ursprüngliche Zeilennummer im YueScript-Code um.
411 411
412**Signature:** 412**Signatur:**
413```lua 413```lua
414pcall: function(f: function, ...: any): boolean, any... 414pcall: function(f: function, ...: any): boolean, any...
415``` 415```
416 416
417**Parameters:** 417**Parameter:**
418 418
419| Parameter | Type | Description | 419| Parameter | Typ | Beschreibung |
420| --- | --- | --- | 420| --- | --- | --- |
421| f | function | The function to call. | 421| f | function | Die aufzurufende Funktion. |
422| ... | any | Arguments to pass to the function. | 422| ... | any | Argumente für die Funktion. |
423 423
424**Returns:** 424**Rückgabe:**
425 425
426| Return Type | Description | 426| Rückgabetyp | Beschreibung |
427| --- | --- | 427| --- | --- |
428| boolean, ... | Status code and function results or error object. | 428| boolean, ... | Statuscode und Funktionsresultate oder Fehlerobjekt. |
429 429
430### require 430### require
431 431
432**Type:** Function. 432**Typ:** Funktion.
433 433
434**Description:** 434**Beschreibung:**
435 435
436Loads a given module. Can be either a Lua module or a YueScript module. 436Lädt ein Modul (Lua oder YueScript).
437Rewrites the error line number to the original line number in the YueScript code if the module is a YueScript module and loading fails. 437Schreibt die Fehlerzeilennummer auf die ursprüngliche Zeilennummer im YueScript-Code um, wenn das Modul ein YueScript-Modul ist und das Laden fehlschlägt.
438 438
439**Signature:** 439**Signatur:**
440```lua 440```lua
441require: function(name: string): any... 441require: function(name: string): any...
442``` 442```
443 443
444**Parameters:** 444**Parameter:**
445 445
446| Parameter | Type | Description | 446| Parameter | Typ | Beschreibung |
447| --- | --- | --- | 447| --- | --- | --- |
448| modname | string | The name of the module to load. | 448| modname | string | Der Name des zu ladenden Moduls. |
449 449
450**Returns:** 450**Rückgabe:**
451 451
452| Return Type | Description | 452| Rückgabetyp | Beschreibung |
453| --- | --- | 453| --- | --- |
454| any | The value stored at package.loaded[modname] if the module is already loaded.Otherwise, tries to find a loader and returns the final value of package.loaded[modname] and a loader data as a second result. | 454| any | Der Wert in `package.loaded[modname]`, falls das Modul bereits geladen ist. Andernfalls wird ein Loader gesucht und der finale Wert von `package.loaded[modname]` sowie Loader-Daten als zweites Ergebnis zurückgegeben. |
455 455
456### p 456### p
457 457
458**Type:** Function. 458**Typ:** Funktion.
459 459
460**Description:** 460**Beschreibung:**
461 461
462Inspects the structures of the passed values and prints string representations. 462Inspiziert die Struktur der übergebenen Werte und gibt String-Repräsentationen aus.
463 463
464**Signature:** 464**Signatur:**
465```lua 465```lua
466p: function(...: any) 466p: function(...: any)
467``` 467```
468 468
469**Parameters:** 469**Parameter:**
470 470
471| Parameter | Type | Description | 471| Parameter | Typ | Beschreibung |
472| --- | --- | --- | 472| --- | --- | --- |
473| ... | any | The values to inspect. | 473| ... | any | Die zu inspizierenden Werte. |
474 474
475### options 475### options
476 476
477**Type:** Field. 477**Typ:** Feld.
478 478
479**Description:** 479**Beschreibung:**
480 480
481The current compiler options. 481Die aktuellen Compiler-Optionen.
482 482
483**Signature:** 483**Signatur:**
484```lua 484```lua
485options: Config.Options 485options: Config.Options
486``` 486```
487 487
488### traceback 488### traceback
489 489
490**Type:** Function. 490**Typ:** Funktion.
491 491
492**Description:** 492**Beschreibung:**
493 493
494The traceback function that rewrites the stack trace line numbers to the original line numbers in the YueScript code. 494Die Traceback-Funktion, die Stacktrace-Zeilennummern auf die ursprünglichen Zeilennummern im YueScript-Code umschreibt.
495 495
496**Signature:** 496**Signatur:**
497```lua 497```lua
498traceback: function(message: string): string 498traceback: function(message: string): string
499``` 499```
500 500
501**Parameters:** 501**Parameter:**
502 502
503| Parameter | Type | Description | 503| Parameter | Typ | Beschreibung |
504| --- | --- | --- | 504| --- | --- | --- |
505| message | string | The traceback message. | 505| message | string | Die Traceback-Nachricht. |
506 506
507**Returns:** 507**Rückgabe:**
508 508
509| Return Type | Description | 509| Rückgabetyp | Beschreibung |
510| --- | --- | 510| --- | --- |
511| string | The rewritten traceback message. | 511| string | Die umgeschriebene Traceback-Nachricht. |
512 512
513### is_ast 513### is_ast
514 514
515**Type:** Function. 515**Typ:** Funktion.
516 516
517**Description:** 517**Beschreibung:**
518 518
519Checks whether the code matches the specified AST. 519Prüft, ob der Code dem angegebenen AST entspricht.
520 520
521**Signature:** 521**Signatur:**
522```lua 522```lua
523is_ast: function(astName: string, code: string): boolean 523is_ast: function(astName: string, code: string): boolean
524``` 524```
525 525
526**Parameters:** 526**Parameter:**
527 527
528| Parameter | Type | Description | 528| Parameter | Typ | Beschreibung |
529| --- | --- | --- | 529| --- | --- | --- |
530| astName | string | The AST name. | 530| astName | string | Der AST-Name. |
531| code | string | The code. | 531| code | string | Der Code. |
532 532
533**Returns:** 533**Rückgabe:**
534 534
535| Return Type | Description | 535| Rückgabetyp | Beschreibung |
536| --- | --- | 536| --- | --- |
537| boolean | Whether the code matches the AST. | 537| boolean | Ob der Code dem AST entspricht. |
538 538
539### AST 539### AST
540 540
541**Type:** Field. 541**Typ:** Feld.
542 542
543**Description:** 543**Beschreibung:**
544 544
545The AST type definition with name, row, column and sub nodes. 545Die AST-Typdefinition mit Name, Zeile, Spalte und Unterknoten.
546 546
547**Signature:** 547**Signatur:**
548```lua 548```lua
549type AST = {string, integer, integer, any} 549type AST = {string, integer, integer, any}
550``` 550```
551 551
552### to_ast 552### to_ast
553 553
554**Type:** Function. 554**Typ:** Funktion.
555 555
556**Description:** 556**Beschreibung:**
557 557
558Converts the code to the AST. 558Konvertiert Code in AST.
559 559
560**Signature:** 560**Signatur:**
561```lua 561```lua
562to_ast: function(code: string, flattenLevel?: number, astName?: string, reserveComment?: boolean): 562to_ast: function(code: string, flattenLevel?: number, astName?: string, reserveComment?: boolean):
563 --[[AST]] AST | nil, 563 --[[AST]] AST | nil,
564 --[[error]] nil | string 564 --[[error]] nil | string
565``` 565```
566 566
567**Parameters:** 567**Parameter:**
568 568
569| Parameter | Type | Description | 569| Parameter | Typ | Beschreibung |
570| --- | --- | --- | 570| --- | --- | --- |
571| code | string | The code. | 571| code | string | Der Code. |
572| flattenLevel | integer | [Optional] The flatten level. Higher level means more flattening. Default is 0. Maximum is 2. | 572| flattenLevel | integer | [Optional] Der Flatten-Level. Höher bedeutet mehr Flattening. Standard ist 0. Maximum ist 2. |
573| astName | string | [Optional] The AST name. Default is "File". | 573| astName | string | [Optional] Der AST-Name. Standard ist "File". |
574| reserveComment | boolean | [Optional] Whether to reserve the original comments. Default is false. | 574| reserveComment | boolean | [Optional] Ob die ursprünglichen Kommentare beibehalten werden. Standard ist false. |
575 575
576**Returns:** 576**Rückgabe:**
577 577
578| Return Type | Description | 578| Rückgabetyp | Beschreibung |
579| --- | --- | 579| --- | --- |
580| AST \| nil | The AST, or nil if the conversion failed. | 580| AST \| nil | Der AST oder `nil`, falls die Konvertierung fehlgeschlagen ist. |
581| string \| nil | The error message, or nil if the conversion succeeded. | 581| string \| nil | Die Fehlermeldung oder `nil`, falls die Konvertierung erfolgreich war. |
582 582
583### format 583### format
584 584
585**Type:** Function. 585**Typ:** Funktion.
586 586
587**Description:** 587**Beschreibung:**
588 588
589Formats the YueScript code. 589Formatiert den YueScript-Code.
590 590
591**Signature:** 591**Signatur:**
592```lua 592```lua
593format: function(code: string, tabSize?: number, reserveComment?: boolean): string 593format: function(code: string, tabSize?: number, reserveComment?: boolean): string
594``` 594```
595 595
596**Parameters:** 596**Parameter:**
597 597
598| Parameter | Type | Description | 598| Parameter | Typ | Beschreibung |
599| --- | --- | --- | 599| --- | --- | --- |
600| code | string | The code. | 600| code | string | Der Code. |
601| tabSize | integer | [Optional] The tab size. Default is 4. | 601| tabSize | integer | [Optional] Die Tab-Größe. Standard ist 4. |
602| reserveComment | boolean | [Optional] Whether to reserve the original comments. Default is true. | 602| reserveComment | boolean | [Optional] Ob die ursprünglichen Kommentare beibehalten werden. Standard ist true. |
603 603
604**Returns:** 604**Rückgabe:**
605 605
606| Return Type | Description | 606| Rückgabetyp | Beschreibung |
607| --- | --- | 607| --- | --- |
608| string | The formatted code. | 608| string | Der formatierte Code. |
609 609
610### __call 610### __call
611 611
612**Type:** Metamethod. 612**Typ:** Metamethod.
613 613
614**Description:** 614**Beschreibung:**
615 615
616Requires the YueScript module. 616Required das YueScript-Modul.
617Rewrites the error line number to the original line number in the YueScript code when loading fails. 617Schreibt die Fehlerzeilennummer bei Ladefehlern auf die ursprüngliche Zeilennummer im YueScript-Code um.
618 618
619**Signature:** 619**Signatur:**
620```lua 620```lua
621metamethod __call: function(self: yue, module: string): any... 621metamethod __call: function(self: yue, module: string): any...
622``` 622```
623 623
624**Parameters:** 624**Parameter:**
625 625
626| Parameter | Type | Description | 626| Parameter | Typ | Beschreibung |
627| --- | --- | --- | 627| --- | --- | --- |
628| module | string | The module name. | 628| module | string | Der Modulname. |
629 629
630**Returns:** 630**Rückgabe:**
631 631
632| Return Type | Description | 632| Rückgabetyp | Beschreibung |
633| --- | --- | 633| --- | --- |
634| any | The module value. | 634| any | Der Modulwert. |
635 635
636## Config 636## Config
637 637
638**Description:** 638**Beschreibung:**
639 639
640The compiler compile options. 640Die Compiler-Optionen.
641 641
642### lint_global 642### lint_global
643 643
644**Type:** Field. 644**Typ:** Feld.
645 645
646**Description:** 646**Beschreibung:**
647 647
648Whether the compiler should collect the global variables appearing in the code. 648Ob der Compiler die globalen Variablen im Code sammeln soll.
649 649
650**Signature:** 650**Signatur:**
651```lua 651```lua
652lint_global: boolean 652lint_global: boolean
653``` 653```
654 654
655### implicit_return_root 655### implicit_return_root
656 656
657**Type:** Field. 657**Typ:** Feld.
658 658
659**Description:** 659**Beschreibung:**
660 660
661Whether the compiler should do an implicit return for the root code block. 661Ob der Compiler für den Root-Codeblock ein implizites Return verwenden soll.
662 662
663**Signature:** 663**Signatur:**
664```lua 664```lua
665implicit_return_root: boolean 665implicit_return_root: boolean
666``` 666```
667 667
668### reserve_line_number 668### reserve_line_number
669 669
670**Type:** Field. 670**Typ:** Feld.
671 671
672**Description:** 672**Beschreibung:**
673 673
674Whether the compiler should reserve the original line number in the compiled code. 674Ob der Compiler die ursprüngliche Zeilennummer im kompilierten Code beibehalten soll.
675 675
676**Signature:** 676**Signatur:**
677```lua 677```lua
678reserve_line_number: boolean 678reserve_line_number: boolean
679``` 679```
680 680
681### reserve_comment 681### reserve_comment
682 682
683**Type:** Field. 683**Typ:** Feld.
684 684
685**Description:** 685**Beschreibung:**
686 686
687Whether the compiler should reserve the original comments in the compiled code. 687Ob der Compiler die ursprünglichen Kommentare im kompilierten Code beibehalten soll.
688 688
689**Signature:** 689**Signatur:**
690```lua 690```lua
691reserve_comment: boolean 691reserve_comment: boolean
692``` 692```
693 693
694### space_over_tab 694### space_over_tab
695 695
696**Type:** Field. 696**Typ:** Feld.
697 697
698**Description:** 698**Beschreibung:**
699 699
700Whether the compiler should use the space character instead of the tab character in the compiled code. 700Ob der Compiler statt Tabzeichen Leerzeichen verwenden soll.
701 701
702**Signature:** 702**Signatur:**
703```lua 703```lua
704space_over_tab: boolean 704space_over_tab: boolean
705``` 705```
706 706
707### same_module 707### same_module
708 708
709**Type:** Field. 709**Typ:** Feld.
710 710
711**Description:** 711**Beschreibung:**
712 712
713Whether the compiler should treat the code to be compiled as the same currently being compiled module. For internal use only. 713Ob der Compiler den zu kompilierenden Code als dasselbe aktuell kompilierte Modul behandeln soll. Nur für internen Gebrauch.
714 714
715**Signature:** 715**Signatur:**
716```lua 716```lua
717same_module: boolean 717same_module: boolean
718``` 718```
719 719
720### line_offset 720### line_offset
721 721
722**Type:** Field. 722**Typ:** Feld.
723 723
724**Description:** 724**Beschreibung:**
725 725
726Whether the compiler error message should include the line number offset. For internal use only. 726Ob die Compiler-Fehlermeldung einen Zeilennummern-Offset enthalten soll. Nur für internen Gebrauch.
727 727
728**Signature:** 728**Signatur:**
729```lua 729```lua
730line_offset: integer 730line_offset: integer
731``` 731```
732 732
733### yue.Config.LuaTarget 733### yue.Config.LuaTarget
734 734
735**Type:** Enumeration. 735**Typ:** Enumeration.
736 736
737**Description:** 737**Beschreibung:**
738 738
739The target Lua version enumeration. 739Die Ziel-Lua-Version.
740 740
741**Signature:** 741**Signatur:**
742```lua 742```lua
743enum LuaTarget 743enum LuaTarget
744 "5.1" 744 "5.1"
@@ -751,71 +751,71 @@ end
751 751
752### options 752### options
753 753
754**Type:** Field. 754**Typ:** Feld.
755 755
756**Description:** 756**Beschreibung:**
757 757
758The extra options to be passed to the compilation function. 758Zusätzliche Optionen für die Kompilierung.
759 759
760**Signature:** 760**Signatur:**
761```lua 761```lua
762options: Options 762options: Options
763``` 763```
764 764
765## Options 765## Options
766 766
767**Description:** 767**Beschreibung:**
768 768
769The extra compiler options definition. 769Zusätzliche Compiler-Optionen.
770 770
771### target 771### target
772 772
773**Type:** Field. 773**Typ:** Feld.
774 774
775**Description:** 775**Beschreibung:**
776 776
777The target Lua version for the compilation. 777Die Ziel-Lua-Version für die Kompilierung.
778 778
779**Signature:** 779**Signatur:**
780```lua 780```lua
781target: LuaTarget 781target: LuaTarget
782``` 782```
783 783
784### path 784### path
785 785
786**Type:** Field. 786**Typ:** Feld.
787 787
788**Description:** 788**Beschreibung:**
789 789
790The extra module search path. 790Zusätzlicher Modul-Suchpfad.
791 791
792**Signature:** 792**Signatur:**
793```lua 793```lua
794path: string 794path: string
795``` 795```
796 796
797### dump_locals 797### dump_locals
798 798
799**Type:** Field. 799**Typ:** Feld.
800 800
801**Description:** 801**Beschreibung:**
802 802
803Whether to dump the local variables in the traceback error message. Default is false. 803Ob lokale Variablen in Traceback-Fehlermeldungen ausgegeben werden sollen. Standard ist false.
804 804
805**Signature:** 805**Signatur:**
806```lua 806```lua
807dump_locals: boolean 807dump_locals: boolean
808``` 808```
809 809
810### simplified 810### simplified
811 811
812**Type:** Field. 812**Typ:** Feld.
813 813
814**Description:** 814**Beschreibung:**
815 815
816Whether to simplify the error message. Default is true. 816Ob Fehlermeldungen vereinfacht werden sollen. Standard ist true.
817 817
818**Signature:** 818**Signatur:**
819```lua 819```lua
820simplified: boolean 820simplified: boolean
821``` 821```