Export Usage and API

Export

Hello! Im a scripter. When I was reading through PartCache , I noticed this bit of code:

-- TYPE DEFINITION: Part Cache Instance
export type PartCache = {
	Open: {[number]: BasePart},
	InUse: {[number]: BasePart},
	CurrentCacheParent: Instance,
	Template: BasePart,
	ExpansionSize: number
}

I’m a little confused what this means, and hoping someone can clarify! Thanks!

1 Like

it means in this format

local PartCache = {
   Open = false; -- is it available or as open
   InUse = false; -- is sombody using it or is it in use?
   CurrentCacheParent = "Part"; -- what is its parent
   Template = "BasePart"; -- what type of object is this?
   ExpansionSize = Vector3.new(0,0,0) -- What size is it
}
1 Like

Im still a little confused… meaning what does export type even do…

This is Luau’s type checking. Not sure how it works but it comes from Luau which is ROBLOX’s language based on Lua.

Scroll all the way down in the link I provided and there’s a module interactions section.

By default type aliases are local to the file they are declared in. To be able to use type aliases in other modules using require , they need to be exported:

export type Point = { x: number, y: number }