Skip to content

Latest commit

 

History

History
39 lines (26 loc) · 2.68 KB

index.md

File metadata and controls

39 lines (26 loc) · 2.68 KB
title description
Luau
Luau is the scripting language creators use in Roblox Studio.

Luau is the scripting language creators use in Roblox Studio. It is a fast, small, safe, gradually typed embeddable scripting language derived from Lua 5.1.

Contributing your Luau scripts for AI training can help enhance Luau-focused AI tools in Studio. For more information, see [Empower Luau creation](https://create.roblox.com/data-collection).

Support in Studio

The Script Editor in Studio supports Luau with autocompletion, syntax highlighting, static linting, type checking, and script analysis. It also shows documentation and function signatures for members of the Roblox Engine API.

Types

Luau includes the following data types:

  • Nil represents non-existence or nothingness. It's different from any other value or data type.
  • Booleans, or bool, have a value of either false or true.
  • Numbers, or double, represent double-precision (64-bit) floating-point numbers.
  • Strings are sequences of characters, such as letters, numbers, and symbols.
  • Tables are arrays or dictionaries of any value except nil.
  • Enums are fixed lists of items.

Luau is dynamically typed by default. Variables, function parameters, and return values can be any data type. This helps you write code faster because you don't need to provide types for each piece of data. You can still declare explicit types for variables in Luau and enable strict type checking to make type issues obvious and easy to locate.

Data Structures

You can also implement the following data structures using primitive data types:

  • Stacks are Last-In-First-Out collections of items that you can implement using tables.
  • Queues are First-In-First-Out collections of items that you can implement using tables.
  • Metatables are tables with advanced configurations that can achieve functionalities such as storing pairs of keys and values and calculating arithmetic operations.

Features

In Luau, variables and functions can have global and local scope within a script. Luau has logical, relational, and compound assignment operators. You can use control structures and functions to control when Luau executes code. Many operators and variable assignments perform type coercion to change values to the types that Luau expects.