mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-21 12:01:38 +00:00
Change to a game.Rojo module instead of _G
This commit is contained in:
parent
b401b6db2f
commit
955b143ced
1 changed files with 15 additions and 8 deletions
|
|
@ -138,14 +138,14 @@ function App:init()
|
|||
|
||||
self.headlessAPI, self.readOnlyHeadlessAPI = HeadlessAPI.new(self)
|
||||
|
||||
-- selene: allow(global_usage)
|
||||
local existingAPI = _G.Rojo
|
||||
if existingAPI then
|
||||
local existingAPIModule = game:FindFirstChild("Rojo")
|
||||
if existingAPIModule and existingAPIModule:IsA("ModuleScript") then
|
||||
local existingAPI = require(existingAPIModule :: ModuleScript)
|
||||
|
||||
local responseEvent = Instance.new("BindableEvent")
|
||||
responseEvent.Event:Once(function(accepted)
|
||||
if accepted then
|
||||
-- selene: allow(global_usage)
|
||||
_G.Rojo = self.readOnlyHeadlessAPI -- Expose headless to other plugins and command bar
|
||||
existingAPI.API = self.readOnlyHeadlessAPI
|
||||
end
|
||||
|
||||
responseEvent:Destroy()
|
||||
|
|
@ -163,7 +163,7 @@ function App:init()
|
|||
responseEvent:Fire(false)
|
||||
end,
|
||||
content = e(ConflictAPIPopup, {
|
||||
existingAPI = existingAPI,
|
||||
existingAPI = existingAPI.API,
|
||||
onAccept = function()
|
||||
responseEvent:Fire(true)
|
||||
end,
|
||||
|
|
@ -176,8 +176,15 @@ function App:init()
|
|||
return state
|
||||
end)
|
||||
else
|
||||
-- selene: allow(global_usage)
|
||||
_G.Rojo = self.readOnlyHeadlessAPI -- Expose headless to other plugins and command bar
|
||||
local ExposedAPIModule = Instance.new("ModuleScript")
|
||||
ExposedAPIModule.Name = "Rojo"
|
||||
ExposedAPIModule.Archivable = false
|
||||
ExposedAPIModule.Source = "return { API = nil }"
|
||||
|
||||
local ExposedAPI = require(ExposedAPIModule)
|
||||
ExposedAPI.API = self.readOnlyHeadlessAPI
|
||||
|
||||
ExposedAPIModule.Parent = game
|
||||
end
|
||||
|
||||
if
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue