|
Returns
|
table
|
|
Prototype
|
string.split(string input, string delimiter[, boolean compress])
|
|
Description
|
Splits the input string by a delimiter, and optionally removes any empty values (compress).
|
Examples
Basic example
string.split("hello|how|are|you||", "|", true)
string.split("hello|how|are|you||", "|", false)
Kick a specified player
Foo = function(args)
local arguments = string.split(args.text, " ", true)
if table.count(arguments) == 2 then if arguments[1] == "!kick" then local plr = Player.Match(arguments[2])
if table.count(plr) > 1 then local playerlist = ""
for k, p in pairs(plr) do
playerlist = playerlist..p:GetName()
if k ~= table.count(plr) then playerlist = playerlist..", "
end
end
args.player:SendChatMessage("Multiple players found, be more specific: "..playerlist, Color(255,0,0))
else
if plr[1] ~= nil then
plr[1]:Kick()
else
args.player:SendChatMessage("Sorry, could not find "..arguments[2], Color(255,0,0))
end
end
end
end
end
Events:Subscribe("PlayerChat", Foo)
Additional Notes
- This method is currently bugged, as despite "compress" being set to true, it still returns an empty value if the delimiter is present at the end of the input string (as shown in the examples).