mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-22 21:41:37 +00:00
Stylua formatting
This commit is contained in:
parent
1042b36046
commit
b8e5fda482
8 changed files with 131 additions and 74 deletions
|
|
@ -85,7 +85,10 @@ function Toggle:render()
|
||||||
Size = self.containerSize:map(function(value)
|
Size = self.containerSize:map(function(value)
|
||||||
local offset = self.props.options ~= nil and 120 or 40
|
local offset = self.props.options ~= nil and 120 or 40
|
||||||
local textBounds = getTextBounds(
|
local textBounds = getTextBounds(
|
||||||
self.props.description, 14, Enum.Font.Gotham, 1.2,
|
self.props.description,
|
||||||
|
14,
|
||||||
|
Enum.Font.Gotham,
|
||||||
|
1.2,
|
||||||
Vector2.new(value.X - offset, math.huge)
|
Vector2.new(value.X - offset, math.huge)
|
||||||
)
|
)
|
||||||
return UDim2.new(1, -offset, 0, textBounds.Y)
|
return UDim2.new(1, -offset, 0, textBounds.Y)
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,11 @@ function ConflictAPIPopup:render()
|
||||||
BackgroundTransparency = 1,
|
BackgroundTransparency = 1,
|
||||||
Size = UDim2.new(1, 0, 0, 0),
|
Size = UDim2.new(1, 0, 0, 0),
|
||||||
AutomaticSize = Enum.AutomaticSize.Y,
|
AutomaticSize = Enum.AutomaticSize.Y,
|
||||||
Text = string.format("Existing: Version %s, Protocol %d", Version.display(self.props.existingAPI.Version), self.props.existingAPI.ProtocolVersion),
|
Text = string.format(
|
||||||
|
"Existing: Version %s, Protocol %d",
|
||||||
|
Version.display(self.props.existingAPI.Version),
|
||||||
|
self.props.existingAPI.ProtocolVersion
|
||||||
|
),
|
||||||
Font = Enum.Font.Gotham,
|
Font = Enum.Font.Gotham,
|
||||||
TextSize = 15,
|
TextSize = 15,
|
||||||
TextColor3 = theme.Setting.DescriptionColor,
|
TextColor3 = theme.Setting.DescriptionColor,
|
||||||
|
|
@ -71,7 +75,11 @@ function ConflictAPIPopup:render()
|
||||||
BackgroundTransparency = 1,
|
BackgroundTransparency = 1,
|
||||||
Size = UDim2.new(1, 0, 0, 0),
|
Size = UDim2.new(1, 0, 0, 0),
|
||||||
AutomaticSize = Enum.AutomaticSize.Y,
|
AutomaticSize = Enum.AutomaticSize.Y,
|
||||||
Text = string.format("Incoming: Version %s, Protocol %d", Version.display(Config.version), Config.protocolVersion),
|
Text = string.format(
|
||||||
|
"Incoming: Version %s, Protocol %d",
|
||||||
|
Version.display(Config.version),
|
||||||
|
Config.protocolVersion
|
||||||
|
),
|
||||||
Font = Enum.Font.Gotham,
|
Font = Enum.Font.Gotham,
|
||||||
TextSize = 15,
|
TextSize = 15,
|
||||||
TextColor3 = theme.Setting.DescriptionColor,
|
TextColor3 = theme.Setting.DescriptionColor,
|
||||||
|
|
|
||||||
|
|
@ -121,17 +121,11 @@ function Notification:render()
|
||||||
|
|
||||||
local paddingX, paddingY, logoSize = 24, 20, 32
|
local paddingX, paddingY, logoSize = 24, 20, 32
|
||||||
local sourceY = if self.props.source then logoSize + 5 else 0
|
local sourceY = if self.props.source then logoSize + 5 else 0
|
||||||
local sourceX = if self.props.source then TextService:GetTextSize(
|
local sourceX = if self.props.source
|
||||||
self.props.source,
|
then TextService:GetTextSize(self.props.source, 15, Enum.Font.GothamMedium, Vector2.new(350, 15)).X + logoSize + 5
|
||||||
15,
|
else 0
|
||||||
Enum.Font.GothamMedium,
|
|
||||||
Vector2.new(350, 15)
|
|
||||||
).X + logoSize + 5 else 0
|
|
||||||
local actionsY = if self.props.actions then 35 else 0
|
local actionsY = if self.props.actions then 35 else 0
|
||||||
local contentX =
|
local contentX = math.max(textBounds.X, buttonsX, sourceX) + (if self.props.thirdParty then 0 else logoSize + 3) + 2
|
||||||
math.max(textBounds.X, buttonsX, sourceX)
|
|
||||||
+ (if self.props.thirdParty then 0 else logoSize + 3)
|
|
||||||
+ 2
|
|
||||||
|
|
||||||
local size = self.binding:map(function(value)
|
local size = self.binding:map(function(value)
|
||||||
return UDim2.fromOffset(
|
return UDim2.fromOffset(
|
||||||
|
|
@ -163,13 +157,16 @@ function Notification:render()
|
||||||
}, {
|
}, {
|
||||||
Logo = e("ImageLabel", {
|
Logo = e("ImageLabel", {
|
||||||
ImageTransparency = transparency,
|
ImageTransparency = transparency,
|
||||||
Image = if self.props.thirdParty then Assets.Images.ThirdPartyPlugin else Assets.Images.PluginButton,
|
Image = if self.props.thirdParty
|
||||||
|
then Assets.Images.ThirdPartyPlugin
|
||||||
|
else Assets.Images.PluginButton,
|
||||||
BackgroundTransparency = 1,
|
BackgroundTransparency = 1,
|
||||||
Size = UDim2.new(0, logoSize, 0, logoSize),
|
Size = UDim2.new(0, logoSize, 0, logoSize),
|
||||||
Position = UDim2.new(0, 0, 0, 0),
|
Position = UDim2.new(0, 0, 0, 0),
|
||||||
AnchorPoint = Vector2.new(0, 0),
|
AnchorPoint = Vector2.new(0, 0),
|
||||||
}),
|
}),
|
||||||
Source = if self.props.source then e("TextLabel", {
|
Source = if self.props.source
|
||||||
|
then e("TextLabel", {
|
||||||
Text = self.props.source,
|
Text = self.props.source,
|
||||||
Font = Enum.Font.GothamMedium,
|
Font = Enum.Font.GothamMedium,
|
||||||
TextSize = 15,
|
TextSize = 15,
|
||||||
|
|
@ -181,7 +178,8 @@ function Notification:render()
|
||||||
Size = UDim2.new(1, -logoSize - 5, 0, logoSize),
|
Size = UDim2.new(1, -logoSize - 5, 0, logoSize),
|
||||||
Position = UDim2.fromOffset(logoSize + 5, 0),
|
Position = UDim2.fromOffset(logoSize + 5, 0),
|
||||||
BackgroundTransparency = 1,
|
BackgroundTransparency = 1,
|
||||||
}) else nil,
|
})
|
||||||
|
else nil,
|
||||||
Message = e("TextLabel", {
|
Message = e("TextLabel", {
|
||||||
Text = self.props.text,
|
Text = self.props.text,
|
||||||
Font = Enum.Font.GothamMedium,
|
Font = Enum.Font.GothamMedium,
|
||||||
|
|
@ -192,7 +190,9 @@ function Notification:render()
|
||||||
TextWrapped = true,
|
TextWrapped = true,
|
||||||
|
|
||||||
Size = UDim2.new(0, textBounds.X, 0, textBounds.Y),
|
Size = UDim2.new(0, textBounds.X, 0, textBounds.Y),
|
||||||
Position = if self.props.thirdParty then UDim2.fromOffset(0, logoSize + 5) else UDim2.fromOffset(logoSize + 3, 0),
|
Position = if self.props.thirdParty
|
||||||
|
then UDim2.fromOffset(0, logoSize + 5)
|
||||||
|
else UDim2.fromOffset(logoSize + 3, 0),
|
||||||
BackgroundTransparency = 1,
|
BackgroundTransparency = 1,
|
||||||
}),
|
}),
|
||||||
Actions = if self.props.actions
|
Actions = if self.props.actions
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,10 @@ function PermissionPopup:render()
|
||||||
BackgroundTransparency = 1,
|
BackgroundTransparency = 1,
|
||||||
Size = UDim2.new(1, 0, 0, 0),
|
Size = UDim2.new(1, 0, 0, 0),
|
||||||
AutomaticSize = Enum.AutomaticSize.Y,
|
AutomaticSize = Enum.AutomaticSize.Y,
|
||||||
Text = string.format("A third-party plugin, %s, is asking to use the following parts of the Rojo API. Please grant/deny access.", self.props.name or "[Unknown]"),
|
Text = string.format(
|
||||||
|
"A third-party plugin, %s, is asking to use the following parts of the Rojo API. Please grant/deny access.",
|
||||||
|
self.props.name or "[Unknown]"
|
||||||
|
),
|
||||||
Font = Enum.Font.GothamMedium,
|
Font = Enum.Font.GothamMedium,
|
||||||
TextSize = 17,
|
TextSize = 17,
|
||||||
TextColor3 = theme.Setting.NameColor,
|
TextColor3 = theme.Setting.NameColor,
|
||||||
|
|
@ -97,7 +100,7 @@ function PermissionPopup:render()
|
||||||
|
|
||||||
ScrollingFrame = e(ScrollingFrame, {
|
ScrollingFrame = e(ScrollingFrame, {
|
||||||
size = self.infoSize:map(function(infoSize)
|
size = self.infoSize:map(function(infoSize)
|
||||||
return UDim2.new(1, 0, 1, -infoSize.Y-44)
|
return UDim2.new(1, 0, 1, -infoSize.Y - 44)
|
||||||
end),
|
end),
|
||||||
layoutOrder = 2,
|
layoutOrder = 2,
|
||||||
contentSize = self.contentSize,
|
contentSize = self.contentSize,
|
||||||
|
|
|
||||||
|
|
@ -110,10 +110,13 @@ function Listing:render()
|
||||||
|
|
||||||
Size = self.containerSize:map(function(value)
|
Size = self.containerSize:map(function(value)
|
||||||
local textBounds = getTextBounds(
|
local textBounds = getTextBounds(
|
||||||
self.props.description, 14, Enum.Font.Gotham, 1.2,
|
self.props.description,
|
||||||
|
14,
|
||||||
|
Enum.Font.Gotham,
|
||||||
|
1.2,
|
||||||
Vector2.new(value.X - 40, math.huge)
|
Vector2.new(value.X - 40, math.huge)
|
||||||
)
|
)
|
||||||
return UDim2.new(1, - 40, 0, textBounds.Y)
|
return UDim2.new(1, -40, 0, textBounds.Y)
|
||||||
end),
|
end),
|
||||||
|
|
||||||
LayoutOrder = 2,
|
LayoutOrder = 2,
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ local function Navbar(props)
|
||||||
onClick = props.onBack,
|
onClick = props.onBack,
|
||||||
}, {
|
}, {
|
||||||
Tip = e(Tooltip.Trigger, {
|
Tip = e(Tooltip.Trigger, {
|
||||||
text = "Back"
|
text = "Back",
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|
@ -55,7 +55,7 @@ local function Navbar(props)
|
||||||
Size = UDim2.new(1, 0, 1, 0),
|
Size = UDim2.new(1, 0, 1, 0),
|
||||||
|
|
||||||
BackgroundTransparency = 1,
|
BackgroundTransparency = 1,
|
||||||
})
|
}),
|
||||||
})
|
})
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
@ -118,7 +118,12 @@ function PermissionsPage:render()
|
||||||
),
|
),
|
||||||
|
|
||||||
onClick = function()
|
onClick = function()
|
||||||
self.props.onEdit(self.props.headlessAPI._sourceToPlugin[source], source, meta, self.props.headlessAPI._permissions[source] or {})
|
self.props.onEdit(
|
||||||
|
self.props.headlessAPI._sourceToPlugin[source],
|
||||||
|
source,
|
||||||
|
meta,
|
||||||
|
self.props.headlessAPI._permissions[source] or {}
|
||||||
|
)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -249,7 +249,14 @@ function App:addNotification(
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function App:addThirdPartyNotification(source: string, text: string, timeout: number?, actions: { [string]: {text: string, style: string, layoutOrder: number, onClick: (any) -> ()} }?)
|
function App:addThirdPartyNotification(
|
||||||
|
source: string,
|
||||||
|
text: string,
|
||||||
|
timeout: number?,
|
||||||
|
actions: {
|
||||||
|
[string]: { text: string, style: string, layoutOrder: number, onClick: (any) -> () },
|
||||||
|
}?
|
||||||
|
)
|
||||||
if not Settings:get("showNotifications") then
|
if not Settings:get("showNotifications") then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
@ -409,15 +416,26 @@ function App:releaseSyncLock()
|
||||||
Log.trace("Could not release sync lock because it is owned by {}", lock.Value)
|
Log.trace("Could not release sync lock because it is owned by {}", lock.Value)
|
||||||
end
|
end
|
||||||
|
|
||||||
function App:requestPermission(plugin: Plugin, source: string, name: string, apis: {string}, initialState: {[string]: boolean?}): {[string]: boolean}
|
function App:requestPermission(
|
||||||
|
plugin: Plugin,
|
||||||
|
source: string,
|
||||||
|
name: string,
|
||||||
|
apis: { string },
|
||||||
|
initialState: { [string]: boolean? }
|
||||||
|
): { [string]: boolean }
|
||||||
local responseEvent = Instance.new("BindableEvent")
|
local responseEvent = Instance.new("BindableEvent")
|
||||||
|
|
||||||
Log.info("The third-party plugin '{}' is requesting permission to use the API!", name)
|
Log.info("The third-party plugin '{}' is requesting permission to use the API!", name)
|
||||||
|
|
||||||
local unloadProtection = if plugin then plugin.Unloading:Connect(function()
|
local unloadProtection = if plugin
|
||||||
Log.warn("Cancelling API permission request for '{}' because the third-party plugin has been removed.", name)
|
then plugin.Unloading:Connect(function()
|
||||||
|
Log.warn(
|
||||||
|
"Cancelling API permission request for '{}' because the third-party plugin has been removed.",
|
||||||
|
name
|
||||||
|
)
|
||||||
responseEvent:Fire(initialState)
|
responseEvent:Fire(initialState)
|
||||||
end) else nil
|
end)
|
||||||
|
else nil
|
||||||
|
|
||||||
self:setState(function(state)
|
self:setState(function(state)
|
||||||
state.popups[source .. " Permissions"] = {
|
state.popups[source .. " Permissions"] = {
|
||||||
|
|
@ -716,7 +734,7 @@ function App:render()
|
||||||
|
|
||||||
local popups = {}
|
local popups = {}
|
||||||
for id, popup in self.state.popups do
|
for id, popup in self.state.popups do
|
||||||
popups["Rojo_"..id] = e(StudioPluginGui, {
|
popups["Rojo_" .. id] = e(StudioPluginGui, {
|
||||||
id = id,
|
id = id,
|
||||||
title = popup.name,
|
title = popup.name,
|
||||||
active = true,
|
active = true,
|
||||||
|
|
@ -854,13 +872,7 @@ function App:render()
|
||||||
for api in apiMap do
|
for api in apiMap do
|
||||||
table.insert(apiList, api)
|
table.insert(apiList, api)
|
||||||
end
|
end
|
||||||
local response = self:requestPermission(
|
local response = self:requestPermission(plugin, source, name, apiList, apiMap)
|
||||||
plugin,
|
|
||||||
source,
|
|
||||||
name,
|
|
||||||
apiList,
|
|
||||||
apiMap
|
|
||||||
)
|
|
||||||
self.headlessAPI:_setPermissions(source, name, response)
|
self.headlessAPI:_setPermissions(source, name, response)
|
||||||
end,
|
end,
|
||||||
}),
|
}),
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,8 @@ function API.new(app)
|
||||||
if info then
|
if info then
|
||||||
return info.Name .. " by " .. info.Creator.Name
|
return info.Name .. " by " .. info.Creator.Name
|
||||||
else
|
else
|
||||||
local success, newInfo = pcall(MarketplaceService.GetProductInfo, MarketplaceService, tonumber(cloudId), Enum.InfoType.Asset)
|
local success, newInfo =
|
||||||
|
pcall(MarketplaceService.GetProductInfo, MarketplaceService, tonumber(cloudId), Enum.InfoType.Asset)
|
||||||
if success then
|
if success then
|
||||||
cloudIdInfoCache[cloudId] = newInfo
|
cloudIdInfoCache[cloudId] = newInfo
|
||||||
return newInfo.Name .. " by " .. newInfo.Creator.Name
|
return newInfo.Name .. " by " .. newInfo.Creator.Name
|
||||||
|
|
@ -119,7 +120,8 @@ function API.new(app)
|
||||||
Creator = info.Creator.Name,
|
Creator = info.Creator.Name,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
local success, newInfo = pcall(MarketplaceService.GetProductInfo, MarketplaceService, tonumber(cloudId), Enum.InfoType.Asset)
|
local success, newInfo =
|
||||||
|
pcall(MarketplaceService.GetProductInfo, MarketplaceService, tonumber(cloudId), Enum.InfoType.Asset)
|
||||||
if success then
|
if success then
|
||||||
cloudIdInfoCache[cloudId] = newInfo
|
cloudIdInfoCache[cloudId] = newInfo
|
||||||
return {
|
return {
|
||||||
|
|
@ -160,14 +162,11 @@ function API.new(app)
|
||||||
Rojo._rateLimit[source] = {
|
Rojo._rateLimit[source] = {
|
||||||
[api] = 0,
|
[api] = 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
elseif Rojo._rateLimit[source][api] == nil then
|
elseif Rojo._rateLimit[source][api] == nil then
|
||||||
Rojo._rateLimit[source][api] = 0
|
Rojo._rateLimit[source][api] = 0
|
||||||
|
|
||||||
elseif Rojo._rateLimit[source][api] >= LIMIT then
|
elseif Rojo._rateLimit[source][api] >= LIMIT then
|
||||||
-- No more than LIMIT requests per BUCKET seconds
|
-- No more than LIMIT requests per BUCKET seconds
|
||||||
return true
|
return true
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
Rojo._rateLimit[source][api] += 1
|
Rojo._rateLimit[source][api] += 1
|
||||||
|
|
@ -182,7 +181,9 @@ function API.new(app)
|
||||||
Rojo._permissionsChanged = Rojo._permissionsChangedEvent.Event
|
Rojo._permissionsChanged = Rojo._permissionsChangedEvent.Event
|
||||||
|
|
||||||
function Rojo:_permissionCheck(key: string): boolean
|
function Rojo:_permissionCheck(key: string): boolean
|
||||||
if apiPermissionAllowlist[key] then return true end
|
if apiPermissionAllowlist[key] then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
local source = Rojo:_getCallerSource()
|
local source = Rojo:_getCallerSource()
|
||||||
if Rojo._permissions[source] == nil then
|
if Rojo._permissions[source] == nil then
|
||||||
|
|
@ -200,10 +201,14 @@ function API.new(app)
|
||||||
|
|
||||||
-- Set permissions
|
-- Set permissions
|
||||||
for api, granted in permissions do
|
for api, granted in permissions do
|
||||||
Log.warn(string.format(
|
Log.warn(
|
||||||
|
string.format(
|
||||||
"%s Rojo.%s for '%s'",
|
"%s Rojo.%s for '%s'",
|
||||||
granted and "Granting permission to" or "Denying permission to", api, name
|
granted and "Granting permission to" or "Denying permission to",
|
||||||
))
|
api,
|
||||||
|
name
|
||||||
|
)
|
||||||
|
)
|
||||||
Rojo._permissions[source][api] = granted
|
Rojo._permissions[source][api] = granted
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -227,9 +232,12 @@ function API.new(app)
|
||||||
end
|
end
|
||||||
|
|
||||||
Rojo._apiDescriptions.RequestAccess = "Used to gain access to Rojo API members"
|
Rojo._apiDescriptions.RequestAccess = "Used to gain access to Rojo API members"
|
||||||
function Rojo:RequestAccess(plugin: Plugin, apis: {string}): {[string]: boolean}
|
function Rojo:RequestAccess(plugin: Plugin, apis: { string }): { [string]: boolean }
|
||||||
assert(type(apis) == "table", "Rojo:RequestAccess expects an array of valid API names as the second argument")
|
assert(type(apis) == "table", "Rojo:RequestAccess expects an array of valid API names as the second argument")
|
||||||
assert(typeof(plugin) == "Instance" and plugin:IsA("Plugin"), "Rojo:RequestAccess expects a Plugin as the first argument")
|
assert(
|
||||||
|
typeof(plugin) == "Instance" and plugin:IsA("Plugin"),
|
||||||
|
"Rojo:RequestAccess expects a Plugin as the first argument"
|
||||||
|
)
|
||||||
|
|
||||||
local source, name = Rojo:_getCallerSource(), Rojo:_getCallerName()
|
local source, name = Rojo:_getCallerSource(), Rojo:_getCallerName()
|
||||||
Rojo._sourceToPlugin[source] = plugin
|
Rojo._sourceToPlugin[source] = plugin
|
||||||
|
|
@ -291,7 +299,7 @@ function API.new(app)
|
||||||
Rojo._apiDescriptions.Test = "Prints the given arguments to the console"
|
Rojo._apiDescriptions.Test = "Prints the given arguments to the console"
|
||||||
function Rojo:Test(...)
|
function Rojo:Test(...)
|
||||||
local args = table.pack(...)
|
local args = table.pack(...)
|
||||||
for i=1, args.n do
|
for i = 1, args.n do
|
||||||
local v = args[i]
|
local v = args[i]
|
||||||
local t = type(v)
|
local t = type(v)
|
||||||
if t == "string" then
|
if t == "string" then
|
||||||
|
|
@ -301,10 +309,14 @@ function API.new(app)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
print(string.format(
|
print(
|
||||||
|
string.format(
|
||||||
"Rojo:Test(%s) called from '%s' (%s)",
|
"Rojo:Test(%s) called from '%s' (%s)",
|
||||||
table.concat(args, ", "), Rojo:_getCallerName(), Rojo:_getCallerSource()
|
table.concat(args, ", "),
|
||||||
))
|
Rojo:_getCallerName(),
|
||||||
|
Rojo:_getCallerSource()
|
||||||
|
)
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
Rojo._apiDescriptions.ConnectAsync = "Connects to a Rojo server"
|
Rojo._apiDescriptions.ConnectAsync = "Connects to a Rojo server"
|
||||||
|
|
@ -347,7 +359,11 @@ function API.new(app)
|
||||||
end
|
end
|
||||||
|
|
||||||
Rojo._apiDescriptions.Notify = "Shows a notification in the Rojo UI"
|
Rojo._apiDescriptions.Notify = "Shows a notification in the Rojo UI"
|
||||||
function Rojo:Notify(msg: string, timeout: number?, actions: { [string]: {text: string, style: string, layoutOrder: number, onClick: (any) -> ()} }?): () -> ()
|
function Rojo:Notify(
|
||||||
|
msg: string,
|
||||||
|
timeout: number?,
|
||||||
|
actions: { [string]: { text: string, style: string, layoutOrder: number, onClick: (any) -> () } }?
|
||||||
|
): () -> ()
|
||||||
assert(type(msg) == "string", "Message must be type `string`")
|
assert(type(msg) == "string", "Message must be type `string`")
|
||||||
assert(type(timeout) == "number" or timeout == nil, "Timeout must be type `number?`")
|
assert(type(timeout) == "number" or timeout == nil, "Timeout must be type `number?`")
|
||||||
assert((actions == nil) or (type(actions) == "table"), "Actions must be table or nil")
|
assert((actions == nil) or (type(actions) == "table"), "Actions must be table or nil")
|
||||||
|
|
@ -365,7 +381,10 @@ function API.new(app)
|
||||||
assert(type(action) == "table", actionId .. " must be table")
|
assert(type(action) == "table", actionId .. " must be table")
|
||||||
assert(type(action.text) == "string", actionId .. ".text must be string")
|
assert(type(action.text) == "string", actionId .. ".text must be string")
|
||||||
assert(type(action.style) == "string", actionId .. ".style must be string")
|
assert(type(action.style) == "string", actionId .. ".style must be string")
|
||||||
assert(action.style == "Solid" or action.style == "Bordered", actionId .. ".style must be 'Solid' or 'Bordered'")
|
assert(
|
||||||
|
action.style == "Solid" or action.style == "Bordered",
|
||||||
|
actionId .. ".style must be 'Solid' or 'Bordered'"
|
||||||
|
)
|
||||||
assert(type(action.layoutOrder) == "number", actionId .. ".layoutOrder must be number")
|
assert(type(action.layoutOrder) == "number", actionId .. ".layoutOrder must be number")
|
||||||
assert(type(action.onClick) == "function", actionId .. ".onClick must be function")
|
assert(type(action.onClick) == "function", actionId .. ".onClick must be function")
|
||||||
|
|
||||||
|
|
@ -409,10 +428,14 @@ function API.new(app)
|
||||||
-- Permissions check
|
-- Permissions check
|
||||||
local granted = Rojo:_permissionCheck(key)
|
local granted = Rojo:_permissionCheck(key)
|
||||||
if not granted then
|
if not granted then
|
||||||
error(string.format(
|
error(
|
||||||
"Attempted to read Rojo.%s, but the plugin does not have permission to do so.\nPlease first use Rojo:RequestAccess({ \"%s\" }) to gain access to this API.",
|
string.format(
|
||||||
key, key
|
'Attempted to read Rojo.%s, but the plugin does not have permission to do so.\nPlease first use Rojo:RequestAccess({ "%s" }) to gain access to this API.',
|
||||||
), 2)
|
key,
|
||||||
|
key
|
||||||
|
),
|
||||||
|
2
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
return Rojo[key]
|
return Rojo[key]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue