@luaut/roblox
v4.0.0
Published
Luau and the whole Roblox API as luaut types: every class, enum, data type, service and global
Readme
@luaut/roblox
Luau and the whole Roblox API as luaut types: every class (921 of them), enum
(633), data type, service and global, plus what Luau adds to Lua — typeof,
buffer, bit32, utf8, table.create, string.split, math.clamp, ...
Luau is Roblox's language, so the two ship together. @luaut/luau was a
package of its own through 2.x; 3.0.0 of this one absorbs it. Underneath is
@luaut/lua, the Lua 5.1 standard library, which this depends on and
is loaded along with it. Needs luaut-parser 3.1 or later.
npm i -D @luaut/roblox{ "types": ["roblox"], "paths": {}, "sourceMap": "sourcemap.json" }With sourceMap pointing at a Rojo sourcemap (rojo sourcemap -o sourcemap.json),
game, workspace and each file's script are typed from the real instance
tree, down to script.Parent.
What you get
- Classes with Roblox's own hierarchy. Every type is a nominal
declare class(Part extends FormFactorPart extends BasePart ...). APartpasses wherever aBasePartorInstanceis expected, but aFolderdoes not pass as aPart, and a table never passes as anInstance.typeof(instance)is"Instance". - Events with typed arguments. In
Players.PlayerAdded:Connect(function(player) ... end),playeris aPlayer. Callbacks assigned to a property, such asremote.OnServerInvoke = function(player, ...), are typed the same way. - Enums.
Enum.KeyCode.Eis anEnum.KeyCode,Enum.Materialworks as a type, and one enum's items do not pass as another's. - Data types with their operators.
Vector3 + Vector3,CFrame * Vector3and2 * vectorget their types from the declared metamethods. - Names checked against the API.
game:GetService("Players"),inst:IsA("BasePart")(which also narrows),Instance.new("Part")andFindFirstChildOfClass("Humanoid")all return the class they name, and a misspelt name is an error.
Deprecated members are left out. Deprecated globals such as wait and
spawn stay.
Where it comes from
index.d.luaut is generated. Don't edit it by hand; change
scripts/generate-roblox.mjs instead — or scripts/luau.d.luaut, the
hand-written Luau layer the generator copies into the head of the file. The generator converts the definitions
luau-lsp builds from the Roblox
API dump, at a pinned commit, into luaut syntax. To pick up a newer API:
npm run generate:roblox # the pinned commit
node scripts/generate-roblox.mjs --commit <luau-lsp commit> # a newer oneluau-lsp is MIT licensed. Its notice is in THIRD_PARTY_NOTICES.md.
