Created
February 12, 2023 18:52
-
-
Save cxmeel/7065a4bc21f7c69018ae628e1eb946e8 to your computer and use it in GitHub Desktop.
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
local function parseImageString(imageString: string) | |
local contentId = imageString:match("(%w+://%S+)") | |
local width = tonumber(select(1, imageString:match("[wW](%d+)"))) | |
local height = tonumber(select(1, imageString:match("[hH](%d+)"))) | |
local x = tonumber(select(1, imageString:match("[xX](%d+)"))) | |
local y = tonumber(select(1, imageString:match("[yY](%d+)"))) | |
local color = imageString:match("(#%x+)") | |
local transparency = tonumber(select(1, imageString:match("(%d+)%%"))) | |
return { | |
Image = contentId, | |
ImageRectSize = (width and height) and Vector2.new(width, height), | |
ImageRectOffset = (x and y) and Vector2.new(x, y), | |
ImageColor3 = color and Color3.fromHex(color), | |
ImageTransparency = transparency and transparency / 100, | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment