Splitting a String

You can use this:

local username, reason = unpack(("username:reason"):split(":"))

Essentially, string.split just returns the values in an array, so you can iterate over the table:

local tbl = ("username:reason"):split(":")

for _, v in pairs(tbl) do
    print(v) -- prints "username", then "reason"
end
5 Likes