-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.lua
80 lines (62 loc) · 1.42 KB
/
main.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
--!strict
--[[
Written by depso
GNU GPLv3 License
https://github.com/depthso
]]
type Table = {
[any]: any
}
local Module = {
--// Package data
Version = "1.0.6",
Author = "Depso",
License = "GNU-GPLv3",
Repository = "https://github.com/depthso/Roblox-parser",
ImportUrl = "https://raw.githubusercontent.com/depthso/Roblox-parser/refs/heads/main",
Modules = {}
}
--// Import modules
local ImportModules = {
"Parser",
"Formatter",
"Variables"
}
local function MergeDict(Base: Table, New: Table)
for Key, Value in next, New do
Base[Key] = Value
end
end
--// This can be replaced
function Module:Import(Name: string)
local Script = script:FindFirstChild(Name)
return require(Script)
end
function Module:Load()
local Modules = self.Modules
for _, Name in next, ImportModules do
Modules[Name] = self:Import(Name)
end
return self
end
function Module:New(Data: Table): Table
local Modules = self.Modules
local Class = {
Variables = Modules.Variables.new(),
Formatter = Modules.Formatter.new(),
Parser = Modules.Parser.new()
}
--// Merge passed data with the shared class data
if Data then
MergeDict(Class, Data)
end
--// Merge class modules
for Name, Value in next, Class do
if typeof(Value) ~= "table" then continue end
if Value.new then
MergeDict(Value, Class)
end
end
return Class
end
return Module