Change to minimal-mistakes theme (#11)
Use minimal-mistakes theme. Add a splash front page and a getting started page.
|
@ -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/
|
||||
|
||||
|
|
2
docs/.bundle/config
Normal file
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
BUNDLE_PATH: "vendor/bundle"
|
6
docs/.gitignore
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
_site
|
||||
.sass-cache
|
||||
.jekyll-cache
|
||||
.jekyll-metadata
|
||||
vendor
|
||||
Gemfile.lock
|
25
docs/404.html
Normal file
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
permalink: /404.html
|
||||
layout: default
|
||||
---
|
||||
|
||||
<style type="text/css" media="screen">
|
||||
.container {
|
||||
margin: 10px auto;
|
||||
max-width: 600px;
|
||||
text-align: center;
|
||||
}
|
||||
h1 {
|
||||
margin: 30px 0;
|
||||
font-size: 4em;
|
||||
line-height: 1;
|
||||
letter-spacing: -1px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="container">
|
||||
<h1>404</h1>
|
||||
|
||||
<p><strong>Page not found :(</strong></p>
|
||||
<p>The requested page could not be found.</p>
|
||||
</div>
|
3
docs/Gemfile
Normal file
|
@ -0,0 +1,3 @@
|
|||
source "https://rubygems.org"
|
||||
gem "github-pages", group: :jekyll_plugins
|
||||
gem "jekyll-include-cache", group: :jekyll_plugins
|
|
@ -1,13 +1,22 @@
|
|||
theme: jekyll-theme-minimal
|
||||
remote_theme: "mmistakes/minimal-mistakes@4.22.0"
|
||||
minimal_mistakes_skin: "default" #"air", "aqua", "contrast", "dark", "dirt", "neon", "mint", "plum" "sunrise"
|
||||
url:
|
||||
name: Roblox
|
||||
title: Luau
|
||||
description: >
|
||||
A fast, small, safe, gradually typed embeddable scripting language derived from Lua
|
||||
<hr/>
|
||||
<a href="why.html">Why Luau?</a><br/>
|
||||
<a href="syntax.html">Syntax</a><br/>
|
||||
<a href="sandbox.html">Sandboxing</a><br/>
|
||||
<a href="compatibility.html">Compatibility</a><br/>
|
||||
<a href="lint.html">Linting</a><br/>
|
||||
<a href="typecheck.html">Type checking</a><br/>
|
||||
<a href="performance.html">Performance</a><br/>
|
||||
<br/><hr/>
|
||||
|
||||
plugins: ["jekyll-include-cache"]
|
||||
include: ["_pages"]
|
||||
atom_feed:
|
||||
hide: true
|
||||
|
||||
defaults:
|
||||
# _docs
|
||||
- scope:
|
||||
path: ""
|
||||
type: "pages"
|
||||
values:
|
||||
layout: "single"
|
||||
sidebar:
|
||||
nav: "pages"
|
||||
|
|
21
docs/_data/navigation.yml
Normal file
|
@ -0,0 +1,21 @@
|
|||
main:
|
||||
- title: Home
|
||||
url: /
|
||||
- title: Getting Started
|
||||
url: /getting-started
|
||||
|
||||
pages:
|
||||
- title: Getting Started
|
||||
url: /getting-started
|
||||
- title: Why Luau?
|
||||
url: /why
|
||||
- title: Syntax
|
||||
url: /syntax
|
||||
- title: Linting
|
||||
url: /lint
|
||||
- title: Performance
|
||||
url: /performance
|
||||
- title: Sandboxing
|
||||
url: /sandbox
|
||||
- title: Typechecking
|
||||
url: /typecheck
|
|
@ -1,49 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="{{ site.lang | default: "en-US" }}">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
{% seo %}
|
||||
<link rel="stylesheet" href="{{ "/assets/css/style.css?v=" | append: site.github.build_revision | relative_url }}">
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrapper">
|
||||
<header>
|
||||
<h1><a href="{{ "/" | absolute_url }}">{{ site.title | default: site.github.repository_name }}</a></h1>
|
||||
|
||||
{% if site.logo %}
|
||||
<img src="{{site.logo | relative_url}}" alt="Logo" />
|
||||
{% endif %}
|
||||
|
||||
<p>{{ site.description | default: site.github.project_tagline }}</p>
|
||||
</header>
|
||||
<section>
|
||||
|
||||
{{ content }}
|
||||
|
||||
</section>
|
||||
<footer>
|
||||
{% if site.github.is_project_page %}
|
||||
<p>This project is maintained by <a href="{{ site.github.owner_url }}">{{ site.github.owner_name }}</a></p>
|
||||
{% endif %}
|
||||
<p><small>Hosted on GitHub Pages — Theme by <a href="https://github.com/orderedlist">orderedlist</a></small></p>
|
||||
</footer>
|
||||
</div>
|
||||
<script src="{{ "/assets/js/scale.fix.js" | relative_url }}"></script>
|
||||
{% if site.google_analytics %}
|
||||
<script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
|
||||
ga('create', '{{ site.google_analytics }}', 'auto');
|
||||
ga('send', 'pageview');
|
||||
</script>
|
||||
{% endif %}
|
||||
</body>
|
||||
</html>
|
159
docs/_pages/getting-started.md
Normal file
|
@ -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.
|
||||
|
||||
<figure>
|
||||
<img src="{{ site.url }}{{ site.baseurl }}/assets/images/create-new-place.png">
|
||||
</figure>
|
||||
|
||||
## Creating a script
|
||||
|
||||
To create your own testing script, go to ServerScriptService in the explorer tree and add a Script object.
|
||||
|
||||
<figure>
|
||||
<img src="{{ site.url }}{{ site.baseurl }}/assets/images/create-script.png">
|
||||
</figure>
|
||||
|
||||
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()``:
|
||||
|
||||
<figure>
|
||||
<img src="{{ site.url }}{{ site.baseurl }}/assets/images/error-ispositive.png">
|
||||
<img src="{{ site.url }}{{ site.baseurl }}/assets/images/error-isfoo.png">
|
||||
</figure>
|
||||
|
||||
## 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:
|
||||
|
||||
<figure>
|
||||
<img src="{{ site.url }}{{ site.baseurl }}/assets/images/error-ispositive-string.png">
|
||||
</figure>
|
||||
|
||||
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:
|
||||
|
||||
<figure>
|
||||
<img src="{{ site.url }}{{ site.baseurl }}/assets/images/error-ispositive-boolean.png">
|
||||
</figure>
|
||||
|
||||
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).
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
layout: default
|
||||
title: LIMITED USE LICENSE
|
||||
permalink: /limited-terms-of-use
|
||||
---
|
||||
<div style="text-align:center;font-weight:bold;">
|
||||
<p>ROBLOX, INC.</p>
|
|
@ -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.
|
||||
|
|
@ -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:
|
||||
|
|
@ -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.
|
||||
|
|
@ -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 (`//`)
|
||||
- `<toclose>` and `<const>` 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).
|
|
@ -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.
|
||||
|
|
@ -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.
|
||||
|
BIN
docs/assets/images/create-new-place.png
Normal file
After Width: | Height: | Size: 624 KiB |
BIN
docs/assets/images/create-script.png
Normal file
After Width: | Height: | Size: 196 KiB |
BIN
docs/assets/images/error-isfoo.png
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
docs/assets/images/error-ispositive-boolean.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
docs/assets/images/error-ispositive-string.png
Normal file
After Width: | Height: | Size: 45 KiB |
BIN
docs/assets/images/error-ispositive.png
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
docs/assets/images/example.png
Normal file
After Width: | Height: | Size: 37 KiB |
BIN
docs/assets/images/luau.png
Normal file
After Width: | Height: | Size: 65 KiB |
|
@ -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
|
||||
|
||||
|
|
|
@ -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" %}
|
||||
|
|