From a8e5aaf64969792741f3a094fe0070ddb5e3bc7d Mon Sep 17 00:00:00 2001 From: Li Jin Date: Tue, 2 Nov 2021 16:12:03 +0800 Subject: update docs. --- CHANGELOG.md | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'CHANGELOG.md') diff --git a/CHANGELOG.md b/CHANGELOG.md index b60bf8a..1c87ff7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ The implementation for the original Moonscript language 0.5.0 can be found in the `0.5.0` branch of Yuescript. The Moonscript with fixes and new features is in the main branch of Yuescript. Here are the changelogs for each Yuescript version. -## v0.8.2 +## v0.8.5 ### Fixed Issues @@ -11,6 +11,38 @@ The implementation for the original Moonscript language 0.5.0 can be found in th ### Added Features +* Nil coalescing operator. +```moonscript +local a, b, c, d +a = b ?? c ?? d +func a ?? {} + +a ??= false +``` +Compiles to: +```lua +local a, b, c, d +if b ~= nil then + a = b +else + if c ~= nil then + a = c + else + a = d + end +end +func((function() + if a ~= nil then + return a + else + return { } + end +end)()) +if a == nil then + a = false +end +``` + * New metatable syntax. ```moonscript #: mt = tb -- cgit v1.2.3-55-g6feb