generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

I need to improve my command parsing

Previous Thread :: Next Thread 
iSpecializinq is not online. iSpecializinq
Joined: 31 May 2015
Total Posts: 2182
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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image