-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce5ab31
commit dcddb24
Showing
5 changed files
with
37 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,35 @@ | ||
-- initialize Loader | ||
local Loader = require(game:GetService('ReplicatedStorage'):WaitForChild('Loader')) | ||
local require = require(game:GetService('ReplicatedStorage'):WaitForChild('Loader')) | ||
|
||
local Cache = {} -- keep track of the modules | ||
local List = {'Manager','Roblox','DataSync','Interface','Network'} -- lets set up a list of modules to require | ||
|
||
local function Boot() -- a simple function to load the modules | ||
for index,module in pairs(List) do -- start up a loop | ||
Cache[module] = require(module) -- require the module | ||
end | ||
|
||
return Cache | ||
end | ||
|
||
-- Built in options, similar to Rusts' "Option" enum, though this compares types | ||
-- Option is created on the global 'shared' by Loader | ||
-- Lua should implement its own Option, would make this so much easier. | ||
shared.Option:Set('result1','string') -- type: string | ||
shared.Option:Set('result2',23876) -- type: number | ||
shared.Option:Set('result3','string') -- type: string | ||
local Get = Boot() -- get the modules & boot em | ||
for index,module in pairs(Get) do | ||
print(module._Name) -- every module has a _Name | ||
end | ||
|
||
print(shared.Option.result1:Match(shared.Option.result2)) --> false | ||
print(shared.Option.result1:Match(shared.Option.result3)) --> true | ||
--[=[ | ||
create a new module, run this in the command bar: | ||
local New = Instance.new('ModuleScript') | ||
New.Name = 'WackyModule' | ||
New.Source = 'return {}' | ||
New.Parent = game:GetService('ReplicatedStorage') | ||
]=] | ||
|
||
local Name = 'WackyModule' | ||
local Find = game:GetService('ReplicatedStorage'):FindFirstChild(Name) | ||
|
||
local RequireByInstance = require(Find) -- require it by instance | ||
local RequireByString = require(Name) -- require that same module | ||
|
||
print(RequireByInstance == RequireByString) --> true, because their the same require table |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters