aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2023-08-09 10:17:57 +0800
committerLi Jin <dragon-fly@qq.com>2023-08-09 10:17:57 +0800
commit949166b7db8ff195ce6f1d8d1fa34c242d267af1 (patch)
tree7300fe3cc676b02d7703513c6a97d8ac2121af31 /doc
parent33260af2175004347a3b9345b67727e596c6fffd (diff)
downloadyuescript-949166b7db8ff195ce6f1d8d1fa34c242d267af1.tar.gz
yuescript-949166b7db8ff195ce6f1d8d1fa34c242d267af1.tar.bz2
yuescript-949166b7db8ff195ce6f1d8d1fa34c242d267af1.zip
update version and docs.v0.18.1
Diffstat (limited to 'doc')
-rwxr-xr-xdoc/docs/doc/README.md24
1 files changed, 23 insertions, 1 deletions
diff --git a/doc/docs/doc/README.md b/doc/docs/doc/README.md
index 4c8ac87..7e4aa22 100755
--- a/doc/docs/doc/README.md
+++ b/doc/docs/doc/README.md
@@ -1181,6 +1181,28 @@ print "OK"
1181</pre> 1181</pre>
1182</YueDisplay> 1182</YueDisplay>
1183 1183
1184## Varargs Assignment
1185
1186You can assign the results returned from a function to a varargs symbol `...`. And then access its content using the Lua way.
1187```moonscript
1188list = {1, 2, 3, 4, 5}
1189fn = (ok) -> ok, table.unpack list
1190ok, ... = fn true
1191count = select '#', ...
1192first = select 1, ...
1193print ok, count, first
1194```
1195<YueDisplay>
1196<pre>
1197list = {1, 2, 3, 4, 5}
1198fn = (ok) -> ok, table.unpack list
1199ok, ... = fn true
1200count = select '#', ...
1201first = select 1, ...
1202print ok, count, first
1203</pre>
1204</YueDisplay>
1205
1184## Whitespace 1206## Whitespace
1185 1207
1186Yuescript 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. 1208Yuescript 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.
@@ -1299,7 +1321,7 @@ catch err
1299 1321
1300## Attributes 1322## Attributes
1301 1323
1302Syntax support for Lua 5.4 attributes. But you can still use `const` declaration and get constant check working when targeting Lua versions below 5.4. 1324Syntax 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.
1303 1325
1304```moonscript 1326```moonscript
1305const a = 123 1327const a = 123