String Splitting Issue

I have an issue. I have a command bar for administrators in my game to use to help moderate my game. The issue is that I have a third argument (command player args) that is typically not a single word and my system cannot detect this. Most commands would be used like this: ban player reason and if the reason is not a single word it will not work.

How would I detect all words after the player argument?

u should be using string.match instead.

local arg1,arg2,arg3 = string.match("/ban noob loser haha","(%w+)%s+(%w+)%s+(.+)")

print(arg1,arg2,arg3)
--[[
/ban
noob
loser haha
]]
3 Likes

I will give you the solution anyways even though I have solved this issue myself using table.concat,
local arg3 = table.concat(split, " ", 3)

1 Like