ModuleScript
Every script in a project runs as a module: require it by its path in the tree and get what it returns.
A .shot file (Script) and a plain .luau file (Luau) are both ModuleScripts when they run. A module requires its own project's modules by instance path, another project's export as require("@Alias") through its header's external line, and a service with use FileService. Every run loads each project again, so a module's body runs once in each run.
A base class: you work with its subclasses.
Example
-- This program is a .shot file and Prices a plain Luau module (Prices.luau, returning a table): both are ModuleScripts.
use Prices
print("an Apple costs " .. Prices.Apple .. ", a Pear " .. Prices.Pear)
local files : {ModuleScript} = { script, root.Prices }
for _, file in files do
print(file.Name .. ": ModuleScript " .. tostring(file:IsA("ModuleScript")) .. ", LuaSourceContainer " .. tostring(file:IsA("LuaSourceContainer")))
end
print("the program's Parent is the project's root: " .. tostring(script.Parent == root))an Apple costs 3, a Pear 2 Main: ModuleScript true, LuaSourceContainer true Prices: ModuleScript true, LuaSourceContainer true the program's Parent is the project's root: true
From ShotInstance 33
ClassNameNameParentAncestryChangedAttributeChangedChangedChildAddedChildRemovedDestroyingAddTagClearAllChildrenCloneDestroyFindFirstAncestorFindFirstAncestorOfClassFindFirstAncestorWhichIsAFindFirstChildFindFirstChildOfClassFindFirstChildWhichIsAGetAttributeGetAttributeChangedSignalGetAttributesGetChildrenGetDescendantsGetFullNameGetPropertyChangedSignalGetTagsHasTagIsAIsAncestorOfIsDescendantOfRemoveTagSetAttribute
Subclasses
