This repository has been archived by the owner on Jan 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Boilerplate.lua
172 lines (144 loc) · 4.59 KB
/
Boilerplate.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
--- A short description of the script.
-- A more detailed and in-depth description of the script. It should explain
-- what this script does.
--
-- @author The Author
-- @version 0.1.0, 2020-03-29
-- @since 0.1
--
-- @module ModuleName
-- @field Field a description of the field
-- @throws Error when the error happens
--
-- @see Reference
-- @deprecated only if it shouldn't be used anymore
local Console = require(game:GetService("ReplicatedStorage"):WaitForChild("Scripts"):WaitForChild("Console")).sourced("Boilerplate")
-- Dependencies --
Console.log("Loading dependencies...")
-- Load all services and require all scripts here unless they must be loaded
-- elsewhere or at a different time.
local RunService = game:GetService("RunService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RequiredScript = require(script.Parent)
local IncludedObject = require(ReplicatedStorage:WaitForChild("Object"))
-- Constants --
Console.log("Initializing constants...")
-- Declare, initialize, and construct all constant, or readonly names here.
--- A short description of the constant.
-- A more detailed and in-depth description of the constant. This is often not
-- necessary for most constants.
--
-- @since 0.1 only if different than the module
--
-- @see Reference
-- @deprecated only if it shouldn't be used anymore
local NumericConstant = 4
--- A short description of the enum.
-- A more detailed and in-depth description of the enum.
--
-- @since 0.1 only if different than the module
--
-- @field First a description of the field
-- @field Second a description of the field
-- @field Third a description of the field
--
-- @see Reference
-- @deprecated only if it shouldn't be used anymore
local LocalEnum = {
["First"] = 1,
["Second"] = 2,
["Third"] = 3
}
-- Functions --
Console.log("Constructing functions...")
-- Declare, initialize, and construct all local functions here.
--- A short description of the function.
-- A more detailed and in-depth description of the function. This should
-- explain what the function does.
--
-- @since 0.1 only if different than the module
--
-- @param param a description of the parameter
-- @return a description of what is returned
-- @throws error when the error happens
--
-- @see Reference
-- @deprecated only if it shouldn't be used anymore
local function localFunction(param)
return param + 1
end
-- Variables --
Console.log("Initializing variables...")
-- Declare and initialize all local variables here.
local Module = {}
local numericValue = 0
--- A short description of the object.
-- A more detailed and in-depth description of the object. This should explain
-- what the object does.
--
-- @since 0.1 only if different than the module
--
-- @field list a description of the field
-- @throws Error when the error happens
--
-- @see Reference
-- @deprecated only if it shouldn't be used anymore
local AccessoryObject = {}
-- Local Objects --
Console.log("Constructing objects...")
-- Construct any objects being created locally here including any main object
-- of the module.
Module.__index = {}
--- A short description of the method.
-- A more detailed and in-depth description of the method. This should
-- explain what the method does.
--
-- @since 0.1 only if different than the module
--
-- @return a description of what is returned
-- @throws error when the error happens
--
-- @see Reference
-- @deprecated only if it shouldn't be used anymore
function Module.new()
local self = setmetatable({}, Module)
return self
end
--- A short description of the method.
-- A more detailed and in-depth description of the method. This should
-- explain what the method does.
--
-- @since 0.1 only if different than the module
--
-- @throws error when the error happens
--
-- @see Reference
-- @deprecated only if it shouldn't be used anymore
function Module:Actiavte()
AccessoryObject:Run(true)
end
AccessoryObject.list = {}
--- A short description of the method.
-- A more detailed and in-depth description of the method. This should
-- explain what the method does.
--
-- @since 0.1 only if different than the module
--
-- @param param a description of the parameter
-- @return a description of what is returned
-- @throws error when the error happens
--
-- @see Reference
-- @deprecated only if it shouldn't be used anymore
function AccessoryObject:Run(param)
table.insert(self.list, param)
return #self.list
end
-- Main --
Console.log("Running...")
-- Execute the main operation of the script here. For many modules (such as
-- those that create objects) this may be empty.
-- End --
Console.log("Done.")
-- This section should only deconstruct objects and return.
return Module.new()