Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions source/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ local ChalkObject = {}; ChalkObject.__index = ChalkObject;

local function GenerateCustomHandlerFunction(Type)
return function(Argument)
local FormatStart = Formats[Type].Start:format(Argument);
local FormatStart = string.format(Formats[Type].Start, Argument);

return function(String)
return `{FormatStart}{String}{Formats[Type].End}`
Expand All @@ -112,7 +112,7 @@ local function GenerateColorFunction(Color)
local G = math.floor(Color.g * 255);
local B = math.floor(Color.b * 255);

local FormatStart = Formats.FONT_COLOR_RGB.Start:format(R, G, B);
local FormatStart = string.format(Formats.FONT_COLOR_RGB.Start, R, G, B);

return `{FormatStart}{String}{Formats.FONT_COLOR_RGB.End}`
end
Expand All @@ -121,9 +121,9 @@ end
local function ValidateHex(String)
if typeof(String) ~= "string" then return end

String = String:gsub("#", "")
String = string.gsub(String, "#", "")

return string.match(String, `^%x%x%x%x%x%x$`)
return string.match(String, `^%x%x%x%x%x%x$`)
end

local CustomHandler = {
Expand All @@ -138,7 +138,7 @@ local CustomHandler = {
local Thickness = Data.Thickness or 1;
local transparency = Data.Transparency or 0;

local FormatStart = Formats.STROKE.Start:format(Color, Joins, Thickness, transparency);
local FormatStart = string.format(Formats.STROKE.Start, Color, Joins, Thickness, transparency);

return function(String)
return `{FormatStart}{String}{Formats.STROKE.End}`
Expand All @@ -156,8 +156,8 @@ local CustomHandler = {
(IsHex and Color3.fromHex(FirstArg)) or
Color3.fromRGB(FirstArg, Args[2], Args[3]);

local FormatStart = (IsHex and Formats.FONT_COLOR_HEX.Start:format(FirstArg:gsub("#", ""))) or
Formats.FONT_COLOR_RGB.Start:format(math.floor(Color.R * 255), math.floor(Color.G * 255), math.floor(Color.B * 255));
local FormatStart = (IsHex and string.format(Formats.FONT_COLOR_HEX.Start, string.gsub(FirstArg, "#", ""))) or
string.format(Formats.FONT_COLOR_RGB.Start, math.floor(Color.R * 255), math.floor(Color.G * 255), math.floor(Color.B * 255));

return function(String)
return `{FormatStart}{String}{Formats.FONT_COLOR_RGB.End}`
Expand All @@ -182,12 +182,12 @@ for Index = 1, BrickColorCount do
local G = math.floor(BrickColor.g * 255);
local B = math.floor(BrickColor.b * 255);

local FormatStart = Formats.FONT_COLOR_RGB.Start:format(R, G, B);
local FormatStart = string.format(Formats.FONT_COLOR_RGB.Start, R, G, B);

return `{FormatStart}{String}{Formats.FONT_COLOR_RGB.End}`
end

ChalkData[BrickColor.Name:lower()] = Function
ChalkData[string.lower(BrickColor.Name)] = Function
ChalkData[BrickColor.Name] = Function
ChalkData[BrickColor] = Function
end
Expand Down Expand Up @@ -220,7 +220,7 @@ function ChalkObject.new(FirstObject)

NextCall = nil;

return Call(unpack(Arguments));
return Call(table.unpack(Arguments));
end

local Results = {};
Expand All @@ -233,7 +233,7 @@ function ChalkObject.new(FirstObject)
table.insert(Results, String);
end

return unpack(Results);
return table.unpack(Results);
end

function Meta:__index(Index)
Expand Down