|
| 01 Aug 2015 05:22 PM |
local function Split(Message) local Table = {} for String in Message:gmatch("([^"..Seperator.."]+)") do Table[#Table + 1] = String end return Table end
^That works, but doesnt add support for things like:
:kill player1,player2
only
:kill player1
-------------------------------------------------------
any ideas how to go about this? |
|
|
| Report Abuse |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 01 Aug 2015 05:24 PM |
Split using a comma? So you can do:
local function Split(Message, Seperator) local Table = {} for String in Message:gmatch("([^"..Seperator.."]+)") do Table[#Table + 1] = String end return Table end
msg = ":kill pl1,pl2" local command, arguments = msg:match("^:(%w+)%s+(.+)"); arguments = Split(arguments, ",");
print(command, unpack(arguments));
-- kill pl1 pl2 |
|
|
| Report Abuse |
|