Table of Contents
Introduction
This is the first post in the luau series explaining how to use a type intersection.
What is a type intersection
A type intersection in luau is Luau's AND operator but for types, an example is:
local X = workspace:WaitForChild("X") :: Part & BasePart & Instance
local TypeAnnotation: Part & BasePart & Instance = workspace:WaitForChild("TypeAnnotation") -- Type annotation
You seperate the types and to use the type intersection between types use &
Explained like your 5
A type intersection is like when your mom asks you to get a type of book that has two genres: Action and Fiction, Thats basicaly what it is but in real life
Notes
NOTE: Const has been released in luau(roblox lua) for some developers but it lacks syntax highlighting and autocomplete
Top comments (0)