diff --git a/docs/_config.yml b/docs/_config.yml index ed345a5b..c2bc6acf 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -1,6 +1,17 @@ remote_theme: "mmistakes/minimal-mistakes@4.22.0" +minimal_mistakes_skin: "air" #, "aqua", "contrast", "dark", "dirt", "neon", "mint", "plum" "sunrise" +url: title: Luau description: > A fast, small, safe, gradually typed embeddable scripting language derived from Lua -plugins: [ jekyll-include-cache ] \ No newline at end of file +plugins: ["jekyll-include-cache"] +include: ["_pages"] + +defaults: + # _docs + - scope: + path: "" + type: "pages" + values: + layout: "single" diff --git a/docs/_data/navigation.yml b/docs/_data/navigation.yml new file mode 100644 index 00000000..a5becb95 --- /dev/null +++ b/docs/_data/navigation.yml @@ -0,0 +1,16 @@ +main: + - title: "Why?" + url: /why + - title: "Syntax" + url: /syntax + - title: "Terms of Use" + url: /limited-terms-of-use + - title: "Linting" + url: /lint + - title: "Performance" + url: /performance + - title: "Sandboxing" + url: /sandbox + - title: "Typechecking" + url: /typecheck + \ No newline at end of file diff --git a/docs/limited-terms-of-use.md b/docs/_pages/limited-terms-of-use.md similarity index 99% rename from docs/limited-terms-of-use.md rename to docs/_pages/limited-terms-of-use.md index c3f4d690..678716a3 100644 --- a/docs/limited-terms-of-use.md +++ b/docs/_pages/limited-terms-of-use.md @@ -1,6 +1,7 @@ --- layout: default title: LIMITED USE LICENSE +permalink: /limited-terms-of-use ---

ROBLOX, INC.

diff --git a/docs/lint.md b/docs/_pages/lint.md similarity index 99% rename from docs/lint.md rename to docs/_pages/lint.md index 8e71958c..69d60a51 100644 --- a/docs/lint.md +++ b/docs/_pages/lint.md @@ -1,3 +1,7 @@ +--- +permalink: /lint +--- + # Linting Luau comes with a set of linting passes, that help make sure that the code is correct and consistent. Unlike the type checker, that models the behavior of the code thoroughly and points toward type mismatches that are likely to result in runtime errors, the linter is more opinionated and produces warnings that can often be safely ignored, although it's recommended to keep the code clean of the warnings. diff --git a/docs/performance.md b/docs/_pages/performance.md similarity index 99% rename from docs/performance.md rename to docs/_pages/performance.md index 0333e7f9..58fab3af 100644 --- a/docs/performance.md +++ b/docs/_pages/performance.md @@ -1,3 +1,7 @@ +--- +permalink: /performance +--- + # Performance One of main goals of Luau is to enable high performance code, with gameplay code being the main use case. This can be viewed as two separate goals: diff --git a/docs/sandbox.md b/docs/_pages/sandbox.md similarity index 99% rename from docs/sandbox.md rename to docs/_pages/sandbox.md index 6b0e7c98..9c78236b 100644 --- a/docs/sandbox.md +++ b/docs/_pages/sandbox.md @@ -1,3 +1,6 @@ +--- +permalink: /sandbox +--- # Sandboxing Luau is safe to embed. Broadly speaking, this means that even in the face of untrusted (and in Roblox case, actively malicious) code, the language and the standard library don't allow any unsafe access to the underlying system, and don't have any bugs that allow escaping out of the sandbox (e.g. to gain native code execution through ROP gadgets et al). Additionally, the VM provides extra features to implement isolation of privileged code from unprivileged code and protect one from the other; this is important if the embedding environment (Roblox) decides to expose some APIs that may not be safe to call from untrusted code, for example because they do provide controlled access to the underlying system or risk PII exposure through fingerprinting etc. diff --git a/docs/syntax.md b/docs/_pages/syntax.md similarity index 99% rename from docs/syntax.md rename to docs/_pages/syntax.md index c4cac9a1..5be450f0 100644 --- a/docs/syntax.md +++ b/docs/_pages/syntax.md @@ -1,3 +1,7 @@ +--- +permalink: /syntax +--- + # Syntax Luau uses the baseline [syntax of Lua 5.1](https://www.lua.org/manual/5.1/manual.html#2). For detailed documentation, please refer to the Lua manual, this is an example: diff --git a/docs/typecheck.md b/docs/_pages/typecheck.md similarity index 99% rename from docs/typecheck.md rename to docs/_pages/typecheck.md index 4a7da30d..cca158ba 100644 --- a/docs/typecheck.md +++ b/docs/_pages/typecheck.md @@ -1,3 +1,6 @@ +--- +permalink: /typecheck +--- # Type checking Luau supports a gradual type system through the use of type annotations and type inference. diff --git a/docs/why.md b/docs/_pages/why.md similarity index 99% rename from docs/why.md rename to docs/_pages/why.md index 0e1846fe..25da418c 100644 --- a/docs/why.md +++ b/docs/_pages/why.md @@ -1,3 +1,6 @@ +--- +permalink: /why +--- # Why Luau? Around 2006, [Roblox](https://www.roblox.com) started using Lua 5.1 as a scripting language for games. Over the years the runtime had to be tweaked to provide a safe, secure sandboxed environment; we gradually started accumulating small library changes and tweaks. diff --git a/docs/assets/images/example.png b/docs/assets/images/example.png new file mode 100644 index 00000000..2f4eedef Binary files /dev/null and b/docs/assets/images/example.png differ diff --git a/docs/index.md b/docs/index.md index fa43c0a5..1667c8c8 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,40 +1,54 @@ -# Luau +--- +title: "Luau" +layout: splash +permalink: / +header: + overlay_color: "#000" + overlay_filter: "0.5" + overlay_image: /assets/images/unsplash-image-1.jpg + actions: + - label: "Download" + url: "https://github.com/mmistakes/minimal-mistakes/" +excerpt: "Luau (lowercase u, /ˈlu.aʊ/) is a fast, small, safe, gradually typed embeddable scripting language derived from Lua. It is used by Roblox game developers to write game code, as well as by Roblox engineers to implement large parts of the user-facing application code as well as portions of the editor (Roblox Studio) as plugins." +feature_row: + - image_path: + title: "Motivation" + excerpt: > + Around 2006, [Roblox](https://www.roblox.com) started using Lua 5.1 as a scripting language for games. Over the years we ended up substantially evolving the implementation and the language; to support growing sophistication of games on the Roblox platform, growing team sizes and large internal teams writing a lot of code for application/editor (1+MLOC as of 2020), we had to invest in performance, ease of use and language tooling, and introduce a gradual type system to the language. [This page](why) goes into more detail about the road that got us here. + - image_path: + title: "Sandboxing" + excerpt: > + Luau limits the set of standard libraries exposed to the users and implements extra sandboxing features to be able to run unprivileged code (written by our game developers) side by side with privileged code (written by us). This results in an execution environment that is different from what is commonplace in Lua. The sandboxing [is described here](sandbox). + - image_path: + title: "Compatibility" + excerpt: > + Whenever possible, Luau aims to be backwards-compatible with Lua 5.1 and at the same time to incorporate features from later revisions of Lua. However, Luau is not a full superset of later versions of Lua - we do not agree with some design decisions made by the Lua authors, and have different use cases and constraints. All post-5.1 Lua features, along with their support status in Luau, [are documented here](compatibility). +feature_row2: + - image_path: /assets/images/example.png + title: "Syntax" + excerpt: > + Luau is syntactically backwards-compatible with Lua 5.1 (code that is valid Lua 5.1 is also valid Luau); however, we have extended the language with a set of syntactical features that make the language more familiar and ergonomic. The syntax [is described here](syntax). + url: "/syntax" +feature_row3: + - image_path: + title: "Analysis" + excerpt: > + To make it easier to write correct code, Luau comes with a set of analysis tools that can surface common mistakes. These consist of a linter and a type checker, colloquially known as "script analysis", and can be used from [Roblox Studio](https://developer.roblox.com/en-us/articles/The-Script-Analysis-Tool) or using SECRET TOOL. The linting passes are [described here](lint), and the type checking user guide can [be found here](typecheck). + - image_path: + title: "Performance" + excerpt: > + In addition to a completely custom front end that implements parsing, linting and type checking, Luau runtime features new bytecode, interpreter and compiler that are heavily tuned for performance. Luau currently does not implement Just-In-Time compilation, but its interpreter is often competitive with LuaJIT interpreter on a wide set of benchmarks. We continue to optimize the runtime and rewrite portions of it to be even more efficient, including plans for a new garbage collector and further library optimizations, as well as an eventual JIT/AOT option. While our overall goal is to minimize the amount of time programmers spend tuning performance, some details about the performance characteristics are [provided for inquisitive minds](performance). + - image_path: + title: "Libraries" + excerpt: > + As a language, Luau is a full superset of Lua 5.1. As far as standard library is concerned, some functions had to be removed from the builtin libraries, and some functions had to be added. Additionally, Luau is currently only runnable from the context of the Roblox engine, which exposes a large API surface [documented on Roblox developer portal](https://developer.roblox.com/en-us/api-reference). -Luau (lowercase u, /ˈlu.aʊ/) is a fast, small, safe, gradually typed embeddable scripting language derived from Lua. It is used by Roblox game developers to write game code, as well as by Roblox engineers to implement large parts of the user-facing application code as well as portions of the editor (Roblox Studio) as plugins. +--- -```lua -type Point = { x: number, y: number } +{% include feature_row id="intro" type="center" %} -local p: Point = { x = 1, y = 2 } +{% include feature_row %} -print(p.x, p.y) --- print(p.z) results in a type error -``` +{% include feature_row id="feature_row2" type="right" %} -## Motivation - -Around 2006, [Roblox](https://www.roblox.com) started using Lua 5.1 as a scripting language for games. Over the years we ended up substantially evolving the implementation and the language; to support growing sophistication of games on the Roblox platform, growing team sizes and large internal teams writing a lot of code for application/editor (1+MLOC as of 2020), we had to invest in performance, ease of use and language tooling, and introduce a gradual type system to the language. [This page](why.md) goes into more detail about the road that got us here. - -## Syntax - -Luau is syntactically backwards-compatible with Lua 5.1 (code that is valid Lua 5.1 is also valid Luau); however, we have extended the language with a set of syntactical features that make the language more familiar and ergonomic. The syntax [is described here](syntax.md). - -## Sandboxing - -Luau limits the set of standard libraries exposed to the users and implements extra sandboxing features to be able to run unprivileged code (written by our game developers) side by side with privileged code (written by us). This results in an execution environment that is different from what is commonplace in Lua. The sandboxing [is described here](sandbox.md). - -## Compatibility - -Whenever possible, Luau aims to be backwards-compatible with Lua 5.1 and at the same time to incorporate features from later revisions of Lua. However, Luau is not a full superset of later versions of Lua - we do not agree with some design decisions made by the Lua authors, and have different use cases and constraints. All post-5.1 Lua features, along with their support status in Luau, [are documented here](compatibility.md). - -## Analysis - -To make it easier to write correct code, Luau comes with a set of analysis tools that can surface common mistakes. These consist of a linter and a type checker, colloquially known as "script analysis", and can be used from [Roblox Studio](https://developer.roblox.com/en-us/articles/The-Script-Analysis-Tool) or using SECRET TOOL. The linting passes are [described here](lint.md), and the type checking user guide can [be found here](typecheck.md). - -## Libraries - -As a language, Luau is a full superset of Lua 5.1. As far as standard library is concerned, some functions had to be removed from the builtin libraries, and some functions had to be added. Additionally, Luau is currently only runnable from the context of the Roblox engine, which exposes a large API surface [documented on Roblox developer portal](https://developer.roblox.com/en-us/api-reference). - -## Performance - -In addition to a completely custom front end that implements parsing, linting and type checking, Luau runtime features new bytecode, interpreter and compiler that are heavily tuned for performance. Luau currently does not implement Just-In-Time compilation, but its interpreter is often competitive with LuaJIT interpreter on a wide set of benchmarks. We continue to optimize the runtime and rewrite portions of it to be even more efficient, including plans for a new garbage collector and further library optimizations, as well as an eventual JIT/AOT option. While our overall goal is to minimize the amount of time programmers spend tuning performance, some details about the performance characteristics are [provided for inquisitive minds](performance.md). +{% include feature_row id="feature_row3" %}