A fast, small, safe, gradually typed embeddable scripting language derived from Lua
Go to file
dependabot[bot] 91ab45ff43
Bump jinja2 from 3.1.2 to 3.1.3 in /tools/fuzz (#1144)
Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.2 to 3.1.3.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/pallets/jinja/releases">jinja2's
releases</a>.</em></p>
<blockquote>
<h2>3.1.3</h2>
<p>This is a fix release for the 3.1.x feature branch.</p>
<ul>
<li>Fix for <a
href="https://github.com/pallets/jinja/security/advisories/GHSA-h5c8-rqwp-cp95">GHSA-h5c8-rqwp-cp95</a>.
You are affected if you are using <code>xmlattr</code> and passing user
input as attribute keys.</li>
<li>Changes: <a
href="https://jinja.palletsprojects.com/en/3.1.x/changes/#version-3-1-3">https://jinja.palletsprojects.com/en/3.1.x/changes/#version-3-1-3</a></li>
<li>Milestone: <a
href="https://github.com/pallets/jinja/milestone/15?closed=1">https://github.com/pallets/jinja/milestone/15?closed=1</a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/pallets/jinja/blob/main/CHANGES.rst">jinja2's
changelog</a>.</em></p>
<blockquote>
<h2>Version 3.1.3</h2>
<p>Released 2024-01-10</p>
<ul>
<li>Fix compiler error when checking if required blocks in parent
templates are
empty. :pr:<code>1858</code></li>
<li><code>xmlattr</code> filter does not allow keys with spaces.
GHSA-h5c8-rqwp-cp95</li>
<li>Make error messages stemming from invalid nesting of <code>{% trans
%}</code> blocks
more helpful. :pr:<code>1918</code></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="d9de4bb215"><code>d9de4bb</code></a>
release version 3.1.3</li>
<li><a
href="50124e1656"><code>50124e1</code></a>
skip test pypi</li>
<li><a
href="9ea7222ef3"><code>9ea7222</code></a>
use trusted publishing</li>
<li><a
href="da703f7aae"><code>da703f7</code></a>
use trusted publishing</li>
<li><a
href="bce1746925"><code>bce1746</code></a>
use trusted publishing</li>
<li><a
href="7277d8068b"><code>7277d80</code></a>
update pre-commit hooks</li>
<li><a
href="5c8a105224"><code>5c8a105</code></a>
Make nested-trans-block exceptions nicer (<a
href="https://redirect.github.com/pallets/jinja/issues/1918">#1918</a>)</li>
<li><a
href="19a55db3b4"><code>19a55db</code></a>
Make nested-trans-block exceptions nicer</li>
<li><a
href="716795349a"><code>7167953</code></a>
Merge pull request from GHSA-h5c8-rqwp-cp95</li>
<li><a
href="7dd3680e6e"><code>7dd3680</code></a>
xmlattr filter disallows keys with spaces</li>
<li>Additional commits viewable in <a
href="https://github.com/pallets/jinja/compare/3.1.2...3.1.3">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=jinja2&package-manager=pip&previous-version=3.1.2&new-version=3.1.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/luau-lang/luau/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-19 06:21:55 -07:00
.github Add benchmarks for native compilation with type info enabled (#1244) 2024-05-02 08:33:47 -07:00
Analysis Sync to upstream/release/639 (#1368) 2024-08-16 11:29:33 -07:00
Ast Sync to upstream/release/639 (#1368) 2024-08-16 11:29:33 -07:00
bench Sync to upstream/release/615 (#1175) 2024-03-01 10:45:26 -08:00
CLI Sync to upstream/release/637 (#1354) 2024-08-02 07:30:04 -07:00
CodeGen Sync to upstream/release/637 (#1354) 2024-08-02 07:30:04 -07:00
Common/include/Luau Sync to upstream/release/637 (#1354) 2024-08-02 07:30:04 -07:00
Compiler Sync to upstream/release/637 (#1354) 2024-08-02 07:30:04 -07:00
Config Sync to upstream/release/637 (#1354) 2024-08-02 07:30:04 -07:00
EqSat Sync to upstream/release/637 (#1354) 2024-08-02 07:30:04 -07:00
extern Sync to upstream/release/597 (#1054) 2023-09-29 18:13:05 -07:00
fuzz Sync to upstream/release/637 (#1354) 2024-08-02 07:30:04 -07:00
tests Sync to upstream/release/639 (#1368) 2024-08-16 11:29:33 -07:00
tools Bump jinja2 from 3.1.2 to 3.1.3 in /tools/fuzz (#1144) 2024-08-19 06:21:55 -07:00
VM Sync to upstream/release/639 (#1368) 2024-08-16 11:29:33 -07:00
.clang-format Sync to upstream/release/637 (#1354) 2024-08-02 07:30:04 -07:00
.gitignore Equality graphs (#1285) 2024-07-16 10:35:20 -07:00
CMakeLists.txt Equality graphs (#1285) 2024-07-16 10:35:20 -07:00
CMakePresets.json Sync to upstream/release/605 (#1118) 2023-12-01 23:46:57 -08:00
CONTRIBUTING.md Update CONTRIBUTING.md 2023-10-30 09:16:59 -07:00
LICENSE.txt Sync to upstream/release/622 (#1232) 2024-04-19 14:48:02 -07:00
lua_LICENSE.txt Sync to upstream/release/501 (#20) 2021-11-01 14:52:34 -07:00
Makefile Add new solver pass to the coverage build (#1341) 2024-07-23 08:08:32 -07:00
README.md Update README.md 2023-11-13 07:41:15 -08:00
SECURITY.md Update native code generation note in the security guarantees (#1250) 2024-05-08 13:35:12 -07:00
Sources.cmake Sync to upstream/release/636 (#1346) 2024-07-26 10:47:49 -07:00

Luau CI codecov

Luau (lowercase u, /ˈlu.aʊ/) is a fast, small, safe, gradually typed embeddable scripting language derived from Lua.

It is designed to be backwards compatible with Lua 5.1, as well as incorporating some features from future Lua releases, but also expands the feature set (most notably with type annotations). Luau is largely implemented from scratch, with the language runtime being a very heavily modified version of Lua 5.1 runtime, with completely rewritten interpreter and other performance innovations. The runtime mostly preserves Lua 5.1 API, so existing bindings should be more or less compatible with a few caveats.

Luau 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. Roblox chose to open-source Luau to foster collaboration within the Roblox community as well as to allow other companies and communities to benefit from the ongoing language and runtime innovation. As a consequence, Luau is now also used by games like Alan Wake 2 and Warframe.

This repository hosts source code for the language implementation and associated tooling. Documentation for the language is available at https://luau-lang.org/ and accepts contributions via site repository; the language is evolved through RFCs that are located in rfcs repository.

Usage

Luau is an embeddable language, but it also comes with two command-line tools by default, luau and luau-analyze.

luau is a command-line REPL and can also run input files. Note that REPL runs in a sandboxed environment and as such doesn't have access to the underlying file system except for ability to require modules.

luau-analyze is a command-line type checker and linter; given a set of input files, it produces errors/warnings according to the file configuration, which can be customized by using --! comments in the files or .luaurc files. For details please refer to type checking and linting documentation.

Installation

You can install and run Luau by downloading the compiled binaries from a recent release; note that luau and luau-analyze binaries from the archives will need to be added to PATH or copied to a directory like /usr/local/bin on Linux/macOS.

Alternatively, you can use one of the packaged distributions (note that these are not maintained by Luau development team):

  • macOS: Install Homebrew and run brew install luau
  • Arch Linux: From the AUR (Arch Linux User Repository), install one of these packages via a AUR helper or manually (by cloning their repo and using makepkg): luau (manual build), luau-git (manual build by cloning this repo), or luau-bin (pre-built binaries from releases)
  • Alpine Linux: Enable community repositories and run apk add luau
  • Gentoo Linux: Luau is officially packaged by Gentoo and can be installed using emerge dev-lang/luau. You may have to unmask the package first before installing it (which can be done by including the --autounmask=y option in the emerge command).

After installing, you will want to validate the installation was successful by running the test case here.

Building

On all platforms, you can use CMake to run the following commands to build Luau binaries from source:

mkdir cmake && cd cmake
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build . --target Luau.Repl.CLI --config RelWithDebInfo
cmake --build . --target Luau.Analyze.CLI --config RelWithDebInfo

Alternatively, on Linux/macOS you can use make:

make config=release luau luau-analyze

To integrate Luau into your CMake application projects as a library, at the minimum you'll need to depend on Luau.Compiler and Luau.VM projects. From there you need to create a new Luau state (using Lua 5.x API such as lua_newstate), compile source to bytecode and load it into the VM like this:

// needs lua.h and luacode.h
size_t bytecodeSize = 0;
char* bytecode = luau_compile(source, strlen(source), NULL, &bytecodeSize);
int result = luau_load(L, chunkname, bytecode, bytecodeSize, 0);
free(bytecode);

if (result == 0)
    return 1; /* return chunk main function */

For more details about the use of host API you currently need to consult Lua 5.x API. Luau closely tracks that API but has a few deviations, such as the need to compile source separately (which is important to be able to deploy VM without a compiler), or lack of __gc support (use lua_newuserdatadtor instead).

To gain advantage of many performance improvements it's highly recommended to use safeenv feature, which sandboxes individual scripts' global tables from each other as well as protects builtin libraries from monkey-patching. For this to work you need to call luaL_sandbox for the global state and luaL_sandboxthread for each new script's execution thread.

Testing

Luau has an internal test suite; in CMake builds it is split into two targets, Luau.UnitTest (for bytecode compiler and type checker/linter tests) and Luau.Conformance (for VM tests). The unit tests are written in C++, whereas the conformance tests are largely written in Luau (see tests/conformance).

Makefile builds combine both into a single target and can be ran via make test.

Dependencies

Luau uses C++ as its implementation language. The runtime requires C++11, whereas the compiler and analysis components require C++17. It should build without issues using Microsoft Visual Studio 2017 or later, or gcc-7 or clang-7 or later.

Other than the STL/CRT, Luau library components don't have external dependencies. The test suite depends on doctest testing framework, and the REPL command-line depends on isocline.

License

Luau implementation is distributed under the terms of MIT License. It is based on Lua 5.x implementation that is MIT licensed as well.

When Luau is integrated into external projects, we ask to honor the license agreement and include Luau attribution into the user-facing product documentation. The attribution using Luau logo is also encouraged.