diff --git a/README.md b/README.md
index cd54fd6e..90ef0980 100644
--- a/README.md
+++ b/README.md
@@ -4,3 +4,4 @@ Luau
Luau 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.
This repository hosts documentation for the language as well as satellite materials, and can be viewed at https://roblox.github.io/luau/
+
diff --git a/docs/.bundle/config b/docs/.bundle/config
new file mode 100644
index 00000000..23692288
--- /dev/null
+++ b/docs/.bundle/config
@@ -0,0 +1,2 @@
+---
+BUNDLE_PATH: "vendor/bundle"
diff --git a/docs/.gitignore b/docs/.gitignore
new file mode 100644
index 00000000..a9cc8ab0
--- /dev/null
+++ b/docs/.gitignore
@@ -0,0 +1,6 @@
+_site
+.sass-cache
+.jekyll-cache
+.jekyll-metadata
+vendor
+Gemfile.lock
\ No newline at end of file
diff --git a/docs/404.html b/docs/404.html
new file mode 100644
index 00000000..086a5c9e
--- /dev/null
+++ b/docs/404.html
@@ -0,0 +1,25 @@
+---
+permalink: /404.html
+layout: default
+---
+
+
+
+
-
- {% if site.google_analytics %}
-
- {% endif %}
-
-
diff --git a/docs/_pages/getting-started.md b/docs/_pages/getting-started.md
new file mode 100644
index 00000000..d5801538
--- /dev/null
+++ b/docs/_pages/getting-started.md
@@ -0,0 +1,159 @@
+---
+permalink: /getting-started
+title: Getting Started
+toc: true
+---
+
+To get started with Luau you need to install Roblox Studio, which you can download [here](https://www.roblox.com/create).
+
+## Creating a place
+
+If you just want to experiment with the language itself, you can create a simple baseplate game.
+
+
+
+## Creating a script
+
+To create your own testing script, go to ServerScriptService in the explorer tree and add a Script object.
+
+
+
+Double-click on the script object and paste this:
+
+```lua
+function ispositive(x)
+ return x > 0
+end
+
+print(ispositive(1))
+print(ispositive("2"))
+
+function isfoo(a)
+ return a == "foo"
+end
+
+print(isfoo("bar"))
+print(isfoo(1))
+```
+
+Note that there are no warnings about calling ``ispositive()`` with a string, or calling ``isfoo()`` a number.
+
+## Type inference
+
+Now modify the script to include ``--!strict`` at the top:
+
+```lua
+--!strict
+
+function ispositive(x)
+ return x > 0
+end
+
+print(ispositive(1))
+print(ispositive("2"))
+
+function isfoo(a)
+ return a == "foo"
+end
+
+print(isfoo("bar"))
+print(isfoo(1))
+```
+
+In ``strict`` mode, Luau will infer types based on analysis of the code flow. There is also ``nonstrict`` mode, where analysis is more conservative and types are more frequently inferred as ``any`` to reduce cases where legitimate code is flagged with warnings.
+
+In this case, Luau will use the ``return x > 0`` statement to infer that ``ispositive()`` is a function taking an integer and returning a boolean. Similarly, it will use the ``return a == "foo"`` statement to infer that ``isfoo()`` is a function taking a string and returning a boolean. Note that in both cases, it was not necessary to add any explicit type annotations.
+
+Based on Luau's type inference, the editor now highlights the incorrect calls to ``ispositive()`` and ``isfoo()``:
+
+
+
+## Annotations
+
+You can add annotations to locals, arguments, and function return types. Among other things, annotations can help enforce that you don't accidentally do something stupid. Here's how we would add annotations to ``ispositive()``:
+
+```lua
+--!strict
+
+function ispositive(x : number) : boolean
+ return x > 0
+end
+
+local result : boolean
+result = ispositive(1)
+
+```
+
+Now we've told explicitly told Luau that ``ispositive()`` accepts a number and returns a boolean. This wasn't strictly (pun intended) necessary in this case, because Luau's inference was able to deduce this already. But even in this case, there are advantages to explicit annotations. Imagine that later we decide to change ``ispositive()`` to return a string value:
+
+```lua
+--!strict
+
+function ispositive(x : number) : boolean
+ if x > 0 then
+ return "yes"
+ else
+ return "no"
+ end
+end
+
+local result : boolean
+result = ispositive(1)
+```
+
+Oops -- we're returning string values, but we forgot to update the function return type. Since we've told Luau that ``ispositive()`` returns a boolean (and that's how we're using it), the call site isn't flagged as an error. But because the annotation doesn't match our code, we get a warning in the function body itself:
+
+
+
+The fix is simple; just change the annotation to declare the return type as a string:
+
+```lua
+--!strict
+
+function ispositive(x : number) : string
+ if x > 0 then
+ return "yes"
+ else
+ return "no"
+ end
+end
+
+local result : boolean
+result = ispositive(1)
+```
+
+Well, almost - since we declared ``result`` as a boolean, the call site is now flagged:
+
+
+
+If we update the type of the local variable, everything is good. Note that we could also just let Luau infer the type of ``result`` by changing it to the single line version ``local result = ispositive(1)``.
+
+```lua
+--!strict
+
+function ispositive(x : number) : string
+ if x > 0 then
+ return "yes"
+ else
+ return "no"
+ end
+end
+
+local result : string
+result = ispositive(1)
+```
+
+## Conclusions
+
+This has been a brief tour of the basic functionality of Luau, but there's lots more to explore. If you're interested in reading more, check out our main reference pages for [syntax](syntax) and [typechecking](typecheck).
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..78db46d9 100644
--- a/docs/lint.md
+++ b/docs/_pages/lint.md
@@ -1,4 +1,8 @@
-# Linting
+---
+permalink: /lint
+title: Linting
+toc: true
+---
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..1d25e4cb 100644
--- a/docs/performance.md
+++ b/docs/_pages/performance.md
@@ -1,4 +1,8 @@
-# Performance
+---
+permalink: /performance
+title: Performance
+toc: true
+---
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..e5d5e4d3 100644
--- a/docs/sandbox.md
+++ b/docs/_pages/sandbox.md
@@ -1,4 +1,8 @@
-# Sandboxing
+---
+permalink: /sandbox
+title: Sandboxing
+toc: true
+---
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 98%
rename from docs/syntax.md
rename to docs/_pages/syntax.md
index c4cac9a1..ce5ab049 100644
--- a/docs/syntax.md
+++ b/docs/_pages/syntax.md
@@ -1,4 +1,8 @@
-# Syntax
+---
+permalink: /syntax
+title: Syntax
+toc: true
+---
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:
@@ -25,7 +29,7 @@ Note that future versions of Lua extend the Lua 5.1 syntax with the following fe
- floor division operator (`//`)
- `` and `` local attributes
-> For details please refer to [compatibility section](compatibility.md).
+> For details please refer to [compatibility section](compatibility).
The rest of this document documents additional syntax used in Luau.
@@ -150,4 +154,4 @@ By default type aliases are local to the file they are declared in. To be able t
export type Point = { x: number, y: number }
```
-For more information please refer to [typechecking documentation](typecheck.md).
+For more information please refer to [typechecking documentation](typecheck).
diff --git a/docs/typecheck.md b/docs/_pages/typecheck.md
similarity index 98%
rename from docs/typecheck.md
rename to docs/_pages/typecheck.md
index 4a7da30d..74ffc30a 100644
--- a/docs/typecheck.md
+++ b/docs/_pages/typecheck.md
@@ -1,4 +1,8 @@
-# Type checking
+---
+permalink: /typecheck
+title: Type checking
+toc: true
+---
Luau supports a gradual type system through the use of type annotations and type inference.
@@ -58,7 +62,7 @@ local b2: B = a1 -- not ok
## Primitive types
-Lua VM supports 8 primitive types: `nil`, `string`, `number`, `boolean`, `table`, `function`, `thread`, and `userdata`. Of these, `table` and `function` are not represented by name, but have their dedicated syntax as covered in this [syntax document](syntax.md), and `userdata` is represented by [concrete types](#Roblox-types); other types can be specified by their name.
+Lua VM supports 8 primitive types: `nil`, `string`, `number`, `boolean`, `table`, `function`, `thread`, and `userdata`. Of these, `table` and `function` are not represented by name, but have their dedicated syntax as covered in this [syntax document](syntax), and `userdata` is represented by [concrete types](#Roblox-types); other types can be specified by their name.
Additionally, we also have `any` which is a special built-in type. It effectively disables all type checking, and thus should be used as last resort.
diff --git a/docs/why.md b/docs/_pages/why.md
similarity index 98%
rename from docs/why.md
rename to docs/_pages/why.md
index 0e1846fe..88eef56b 100644
--- a/docs/why.md
+++ b/docs/_pages/why.md
@@ -1,4 +1,7 @@
-# Why Luau?
+---
+permalink: /why
+title: 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/create-new-place.png b/docs/assets/images/create-new-place.png
new file mode 100644
index 00000000..63a29242
Binary files /dev/null and b/docs/assets/images/create-new-place.png differ
diff --git a/docs/assets/images/create-script.png b/docs/assets/images/create-script.png
new file mode 100644
index 00000000..a0481ef0
Binary files /dev/null and b/docs/assets/images/create-script.png differ
diff --git a/docs/assets/images/error-isfoo.png b/docs/assets/images/error-isfoo.png
new file mode 100644
index 00000000..aa33ca6f
Binary files /dev/null and b/docs/assets/images/error-isfoo.png differ
diff --git a/docs/assets/images/error-ispositive-boolean.png b/docs/assets/images/error-ispositive-boolean.png
new file mode 100644
index 00000000..643c4da3
Binary files /dev/null and b/docs/assets/images/error-ispositive-boolean.png differ
diff --git a/docs/assets/images/error-ispositive-string.png b/docs/assets/images/error-ispositive-string.png
new file mode 100644
index 00000000..32cce31b
Binary files /dev/null and b/docs/assets/images/error-ispositive-string.png differ
diff --git a/docs/assets/images/error-ispositive.png b/docs/assets/images/error-ispositive.png
new file mode 100644
index 00000000..183856c3
Binary files /dev/null and b/docs/assets/images/error-ispositive.png differ
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/assets/images/luau.png b/docs/assets/images/luau.png
new file mode 100644
index 00000000..a125b13b
Binary files /dev/null and b/docs/assets/images/luau.png differ
diff --git a/docs/compatibility.md b/docs/compatibility.md
index fa19a388..7ecd2c06 100644
--- a/docs/compatibility.md
+++ b/docs/compatibility.md
@@ -37,7 +37,7 @@ Since several features were removed from Lua 5.1 for sandboxing reasons, this ta
| `loadfile`, `dofile` | removed for sandboxing, no direct file access |
| `loadstring` bytecode and `string.dump` | exposing bytecode is dangerous for sandboxing reasons |
-Sandboxing challenges are [covered in the dedicated section](sandbox.md).
+Sandboxing challenges are [covered in the dedicated section](sandbox).
## Lua 5.2
diff --git a/docs/index.md b/docs/index.md
index fa43c0a5..b988513a 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -1,40 +1,80 @@
-# Luau
+---
+title: Lua*u*
+layout: splash
+permalink: /
-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.
+header:
+ overlay_color: #000
+ overlay_filter: 0.8
+ overlay_image: /assets/images/luau.png
+ actions:
+ - label: Learn More
+ url: /why
-```lua
-type Point = { x: number, y: number }
+excerpt: >
+ Lua*u* (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.
-local p: Point = { x = 1, y = 2 }
+feature_row1:
+ -
+ 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.
+ url: /why
+ btn_label: Learn More
+ btn_class: "btn--primary"
-print(p.x, p.y)
--- print(p.z) results in a type error
-```
+ -
+ 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.
+ url: /sandbox
+ btn_label: Learn More
+ btn_class: "btn--primary"
-## Motivation
+ -
+ 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).
+ url: /compatibility
+ btn_label: Learn More
+ btn_class: "btn--primary"
-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.
+feature_row2:
+ -
+ title: Syntax
+ image_path: /assets/images/example.png
+ 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
+ btn:label: Learn More
+ btn_class: "btn--primary"
-## Syntax
+feature_row3:
+ -
+ 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).
+ url: /typecheck
+ btn_label: Learn More
+ btn_class: "btn--primary"
-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).
+ -
+ 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).
+ url: /performance
+ btn_label: Learn More
+ btn_class: "btn--primary"
-## Sandboxing
+ -
+ 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 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
+{% include feature_row id="feature_row1" %}
-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).
+{% include feature_row id="feature_row2" type="left" %}
-## 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" %}