Clean up some yuescript syntax in corescripts

This commit is contained in:
Lewin Kelly 2023-04-19 11:18:02 +01:00
parent fb57c2199f
commit a98951aca6
10 changed files with 40 additions and 50 deletions

View File

@ -32,16 +32,6 @@ local t = {}
--CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
--CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
local string = string
local math = math
local table = table
local error = error
local tonumber = tonumber
local tostring = tostring
local type = type
local setmetatable = setmetatable
local pairs = pairs
local ipairs = ipairs
local assert = assert
local StringBuilder = {

View File

@ -29,7 +29,7 @@ New = (className, name, props) ->
-- Variables
contextActionService = Game\GetService "ContextActionService"
isTouchDevice = Game\GetService("UserInputService").TouchEnabled
isTouchDevice = Game\GetService"UserInputService".TouchEnabled
functionTable = {}
buttonVector = {}
local buttonScreenGui
@ -99,7 +99,7 @@ contextButtonUp = (button, inputObject, actionName) ->
contextActionService\CallFunction actionName, Enum.UserInputState.End, inputObject
isSmallScreenDevice = ->
Game\GetService("GuiService")\GetScreenResolution!.y <= 320
Game\GetService"GuiService"\GetScreenResolution!.y <= 320
createNewButton = (actionName, functionInfoTable) ->
contextButton = New "ImageButton", "ContextActionButton"
@ -114,7 +114,7 @@ createNewButton = (actionName, functionInfoTable) ->
local currentButtonTouch
Game\GetService("UserInputService").InputEnded\connect (inputObject) ->
Game\GetService"UserInputService".InputEnded\connect (inputObject) ->
oldTouches[inputObject] = nil
contextButton.InputBegan\connect (inputObject) ->

View File

@ -44,7 +44,7 @@ if not success
----------------------------------------------------------------------------
----------------------------------------------------------------------------
-- Variables
screenResolution = Game\GetService("GuiService")\GetScreenResolution!
screenResolution = Game\GetService"GuiService"\GetScreenResolution!
isSmallScreenDevice = ->
return screenResolution.y <= 320
@ -74,7 +74,7 @@ PinchZoomDelay = 0.2
local cameraTouch
-- make sure all of our images are good to go
Game\GetService("ContentProvider")\Preload touchControlsSheet
Game\GetService"ContentProvider"\Preload touchControlsSheet
----------------------------------------------------------------------------
----------------------------------------------------------------------------

View File

@ -107,7 +107,7 @@ for i = 1, #bottomLeftChildren
bottomRightChildren = bottomRightControl\GetChildren!
for i = 1, #bottomRightChildren
if bottomRightChildren[i].Name\find("Camera")?
if bottomRightChildren[i].Name\find"Camera"?
with cameraTip = frameTip\clone!
.RobloxLocked = true
.Text = "Camera View"

View File

@ -6,7 +6,7 @@ scriptContext = game\GetService "ScriptContext"
touchEnabled = false
try
touchEnabled = game\GetService("UserInputService").TouchEnabled
touchEnabled = game\GetService"UserInputService".TouchEnabled
-- library registration
scriptContext\AddCoreScript 60595695, scriptContext, "/Libraries/LibraryRegistration/LibraryRegistration"
@ -23,8 +23,8 @@ waitForChild = (instance, name) ->
scriptContext = game\GetService "ScriptContext"
scriptContext\AddCoreScript 59002209, scriptContext, "CoreScripts/Sections"
waitForChild game\GetService("CoreGui"), "RobloxGui"
screenGui = game\GetService("CoreGui")\FindFirstChild "RobloxGui"
waitForChild game\GetService"CoreGui", "RobloxGui"
screenGui = game\GetService"CoreGui"\FindFirstChild "RobloxGui"
if not touchEnabled
-- ToolTipper (creates tool tips for gui)

View File

@ -186,7 +186,7 @@ while true
table.insert backpackTools, currentChildren[i]
for i = 1, #backpackTools
if not backpackTools[i]\FindFirstChild("RobloxBuildTool")?
if not backpackTools[i]\FindFirstChild"RobloxBuildTool"?
hider\Clone!.Parent = backpackTools[i]
backpackTools[i].Parent = game.Lighting

View File

@ -464,10 +464,10 @@ addDialog = (dialog) ->
addDialog dialog
fetchScripts = ->
model = game\GetService("InsertService")\LoadAsset 39226062
model = game\GetService"InsertService"\LoadAsset 39226062
if type(model) == "string" -- load failed, lets try again
wait 0.1
model = game\GetService("InsertService")\LoadAsset 39226062
model = game\GetService"InsertService"\LoadAsset 39226062
return if type(model) == "string" -- not going to work, lets bail
waitForChild model, "TimeoutScript"

View File

@ -1686,7 +1686,7 @@ binaryShrink = (min, max, fits) ->
getGuiOwner = (instance) ->
while instance?
if instance\IsA("ScreenGui") or instance\IsA("BillboardGui")
if instance\IsA"ScreenGui" or instance\IsA"BillboardGui"
return instance
instance = instance.Parent
@ -2133,7 +2133,7 @@ t.CreateSetPanel = (userIdsForSets, objectSelected, dialogClosed, size, position
buttonHeight = buttonWidth
local SmallThumbnailUrl, LargeThumbnailUrl
BaseUrl = game\GetService("ContentProvider").BaseUrl\lower!
BaseUrl = game\GetService"ContentProvider".BaseUrl\lower!
LargeThumbnailUrl, SmallThumbnailUrl = if useAssetVersionId
"#{BaseUrl}Game/Tools/ThumbnailAsset.ashx?fmt=png&wd=420&ht=420&assetversionid=", "#{BaseUrl}Game/Tools/ThumbnailAsset.ashx?fmt=png&wd=75&ht=75&assetversionid="
@ -2410,7 +2410,7 @@ t.CreateSetPanel = (userIdsForSets, objectSelected, dialogClosed, size, position
showLargePreview = (insertButton) ->
if insertButton\FindFirstChild "AssetId"
delay 0, ->
game\GetService("ContentProvider")\Preload LargeThumbnailUrl .. "#{insertButton.AssetId.Value}"
game\GetService"ContentProvider"\Preload LargeThumbnailUrl .. "#{insertButton.AssetId.Value}"
setGui.SetPanel.ItemPreview.LargePreview.Image = LargeThumbnailUrl .. "#{insertButton.AssetId.Value}"
if insertButton\FindFirstChild "AssetName"
@ -2526,7 +2526,7 @@ t.CreateSetPanel = (userIdsForSets, objectSelected, dialogClosed, size, position
newImageUrl = SmallThumbnailUrl .. assetId
if newImageUrl ~= insertFrame.Button.ButtonImage.Image
delay 0, ->
game\GetService("ContentProvider")\Preload(SmallThumbnailUrl .. assetId)
game\GetService"ContentProvider"\Preload(SmallThumbnailUrl .. assetId)
insertFrame.Button.ButtonImage.Image = SmallThumbnailUrl .. assetId
table.insert(
@ -2616,7 +2616,7 @@ t.CreateSetPanel = (userIdsForSets, objectSelected, dialogClosed, size, position
.Button = button
if not SetCache[setId]?
SetCache[setId] = game\GetService("InsertService")\GetCollection setId
SetCache[setId] = game\GetService"InsertService"\GetCollection setId
.Contents = SetCache[setId]
.SetName = setName
@ -2739,7 +2739,7 @@ t.CreateSetPanel = (userIdsForSets, objectSelected, dialogClosed, size, position
userData = {}
for id = 1, #userIdsForSets
newUserData = game\GetService("InsertService")\GetUserSets userIdsForSets[id]
newUserData = game\GetService"InsertService"\GetUserSets userIdsForSets[id]
if newUserData and #newUserData > 2
-- start at #3 to skip over My Decals and My Models for each account
for category = 3, #newUserData
@ -2949,7 +2949,7 @@ t.CreateTerrainMaterialSelector = (size, position) ->
frame, terrainMaterialSelectionChanged, forceTerrainMaterialSelection
t.CreateLoadingFrame = (name, size, position) ->
game\GetService("ContentProvider")\Preload "http://www.roblox.com/asset/?id=35238053"
game\GetService"ContentProvider"\Preload "http://www.roblox.com/asset/?id=35238053"
loadingFrame = New "Frame", "LoadingFrame"
Style: Enum.FrameStyle.RobloxRound
@ -3270,7 +3270,7 @@ t.CreatePluginFrame = (name, size, position, scrollable, parent) ->
size.Y.Scale, size.Y.Offset
else
0, 400
\FindFirstChild("ScrollDownButton").Position = UDim2.new 0, 0, 1, -20
\FindFirstChild"ScrollDownButton".Position = UDim2.new 0, 0, 1, -20
.Parent = dragBar

View File

@ -94,7 +94,7 @@ game.Players.FriendRequestEvent\connect (fromPlayer, toPlayer, event) ->
if fromPlayer == localPlayer
if event == Enum.FriendRequestEvent.Accept
game\GetService("GuiService")\SendNotification(
game\GetService"GuiService"\SendNotification(
"You are Friends",
"With #{toPlayer.Name}!",
"http://www.roblox.com/thumbs/avatar.ashx?userId=#{toPlayer.userId}&x=48&y=48",
@ -106,7 +106,7 @@ game.Players.FriendRequestEvent\connect (fromPlayer, toPlayer, event) ->
if friendRequestBlacklist[fromPlayer]
return
-- previously cancelled friend request, we don't want it!
game\GetService("GuiService")\SendNotification(
game\GetService"GuiService"\SendNotification(
"Friend Request",
"From #{fromPlayer.Name}",
"http://www.roblox.com/thumbs/avatar.ashx?userId=#{fromPlayer.userId}&x=48&y=48",
@ -114,7 +114,7 @@ game.Players.FriendRequestEvent\connect (fromPlayer, toPlayer, event) ->
-> makeFriend fromPlayer, toPlayer
)
elseif event == Enum.FriendRequestEvent.Accept
game\GetService("GuiService")\SendNotification(
game\GetService"GuiService"\SendNotification(
"You are Friends",
"With #{fromPlayer.Name}!",
"http://www.roblox.com/thumbs/avatar.ashx?userId=#{fromPlayer.userId}&x=48&y=48",
@ -135,7 +135,7 @@ showTeleportUI = (message, timer) ->
\Remove!
onTeleport = (teleportState, _, _) ->
if game\GetService("TeleportService").CustomizedTeleportUI == false
if game\GetService"TeleportService".CustomizedTeleportUI == false
showTeleportUI switch teleportState
when Enum.TeleportState.Started
"Teleport started...", 0
@ -149,13 +149,13 @@ onTeleport = (teleportState, _, _) ->
if teleportEnabled
localPlayer.OnTeleport\connect onTeleport
game\GetService("TeleportService").ErrorCallback = (message) ->
game\GetService"TeleportService".ErrorCallback = (message) ->
popup = script.Parent\FindFirstChild "Popup"
showOneButton!
popup.PopupText.Text = message
local clickCon
clickCon = popup.OKButton.MouseButton1Click\connect ->
game\GetService("TeleportService")\TeleportCancel!
game\GetService"TeleportService"\TeleportCancel!
if clickCon
clickCon\disconnect!
game.GuiService\RemoveCenterDialog script.Parent\FindFirstChild "Popup"
@ -173,7 +173,7 @@ if teleportEnabled
--ShowFunction
->
showOneButton!
script.Parent\FindFirstChild("Popup").Visible = true
script.Parent\FindFirstChild"Popup".Visible = true
popup\TweenSize UDim2.new(0, 330, 0, 350), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 1, true
--HideFunction
->
@ -186,7 +186,7 @@ if teleportEnabled
makePopupInvisible!
)
)
game\GetService("TeleportService").ConfirmationCallback = (message, placeId, spawnName) ->
game\GetService"TeleportService".ConfirmationCallback = (message, placeId, spawnName) ->
popup = script.Parent\FindFirstChild "Popup"
popup.PopupText.Text = message
popup.PopupImage.Image = ""
@ -210,7 +210,7 @@ if teleportEnabled
yesCon = popup.AcceptButton.MouseButton1Click\connect ->
killCons!
local success, err = try
game\GetService("TeleportService")\TeleportImpl placeId, spawnName
game\GetService"TeleportService"\TeleportImpl placeId, spawnName
if not success
showOneButton!
popup.PopupText.Text = err
@ -231,7 +231,7 @@ if teleportEnabled
--ShowFunction
->
showOneButton!
script.Parent\FindFirstChild("Popup").Visible = true
script.Parent\FindFirstChild"Popup".Visible = true
popup\TweenSize(
UDim2.new(0, 330, 0, 350),
Enum.EasingDirection.Out,
@ -254,7 +254,7 @@ if teleportEnabled
noCon = popup.DeclineButton.MouseButton1Click\connect ->
killCons!
try
game\GetService("TeleportService")\TeleportCancel!
game\GetService"TeleportService"\TeleportCancel!
centerDialogSuccess = try
game.GuiService\AddCenterDialog(
@ -265,7 +265,7 @@ if teleportEnabled
showTwoButtons!
popup.AcceptButton.Text = "Leave"
popup.DeclineButton.Text = "Stay"
script.Parent\FindFirstChild("Popup").Visible = true
script.Parent\FindFirstChild"Popup".Visible = true
popup\TweenSize(
UDim2.new(0, 330, 0, 350),
Enum.EasingDirection.Out,
@ -286,7 +286,7 @@ if teleportEnabled
)
if centerDialogSuccess == false
script.Parent\FindFirstChild("Popup").Visible = true
script.Parent\FindFirstChild"Popup".Visible = true
popup.AcceptButton.Text = "Leave"
popup.DeclineButton.Text = "Stay"
popup\TweenSize UDim2.new(0, 330, 0, 350), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 1, true

View File

@ -42,7 +42,7 @@ waitForProperty = (instance, property) ->
IsTouchDevice = ->
touchEnabled = false
try
touchEnabled = Game\GetService("UserInputService").TouchEnabled
touchEnabled = Game\GetService"UserInputService".TouchEnabled
touchEnabled
IsPhone = ->
@ -322,7 +322,7 @@ Tabs = New "Frame", "Tabs"
* New "ImageLabel", "XImage"
RobloxLocked: true
Image: (->
game\GetService("ContentProvider")\Preload "http://www.roblox.com/asset/?id=75547445"
game\GetService"ContentProvider"\Preload "http://www.roblox.com/asset/?id=75547445"
"http://www.roblox.com/asset/?id=75547445"
)! --TODO: move to rbxasset
BackgroundTransparency: 1
@ -685,7 +685,7 @@ CharacterPane = New "Frame", "CharacterPane"
--CharacterPane Children
FaceFrame = makeCharFrame "FacesFrame", CharacterPane
game\GetService("ContentProvider")\Preload "http://www.roblox.com/asset/?id=75460621"
game\GetService"ContentProvider"\Preload "http://www.roblox.com/asset/?id=75460621"
makeZone(
"FaceZone",
"http://www.roblox.com/asset/?id=75460621",
@ -706,7 +706,7 @@ makeZone(
makeStyledButton "Head", UDim2.new(0, 64, 0, 64), UDim2.new(0.5, -32, 0.5, -135), HeadFrame
HatsFrame = makeCharFrame "HatsFrame", CharacterPane
game\GetService("ContentProvider")\Preload "http://www.roblox.com/asset/?id=75457888"
game\GetService"ContentProvider"\Preload "http://www.roblox.com/asset/?id=75457888"
HatsZone = makeZone(
"HatsZone",
"http://www.roblox.com/asset/?id=75457888",
@ -737,7 +737,7 @@ makeStyledButton(
)
PantsFrame = makeCharFrame "PantsFrame", CharacterPane
game\GetService("ContentProvider")\Preload "http://www.roblox.com/asset/?id=75457920"
game\GetService"ContentProvider"\Preload "http://www.roblox.com/asset/?id=75457920"
makeZone(
"PantsZone",
"http://www.roblox.com/asset/?id=75457920",
@ -810,7 +810,7 @@ leftArmButton = makeStyledButton(
makeTextLabel "LeftArmLabel", "Left Arm", UDim2.new(0.5, -16, 0, -25), leftArmButton
TShirtFrame = makeCharFrame "T-ShirtsFrame", CharacterPane
game\GetService("ContentProvider")\Preload "http://www.roblox.com/asset/?id=75460642"
game\GetService"ContentProvider"\Preload "http://www.roblox.com/asset/?id=75460642"
makeZone(
"TShirtZone",
"http://www.roblox.com/asset/?id=75460642",
@ -831,7 +831,7 @@ makeZone(
makeStyledButton "ShirtButton", UDim2.new(0, 64, 0, 64), UDim2.new(0.5, -32, 0.5, -64), ShirtFrame
ColorFrame = makeCharFrame "ColorFrame", CharacterPane
game\GetService("ContentProvider")\Preload "http://www.roblox.com/asset/?id=76049888"
game\GetService"ContentProvider"\Preload "http://www.roblox.com/asset/?id=76049888"
ColorZone = makeZone(
"ColorZone",
"http://www.roblox.com/asset/?id=76049888",