diff options
Diffstat (limited to 'gamemode/chatcommands.lua')
| -rw-r--r-- | gamemode/chatcommands.lua | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/gamemode/chatcommands.lua b/gamemode/chatcommands.lua index 9989054..39260a3 100644 --- a/gamemode/chatcommands.lua +++ b/gamemode/chatcommands.lua @@ -1,6 +1,32 @@ function GM:PlayerSay( ply, text, teamonly ) - local args = string.Explode( " ", text ) + local args = {} + args[1] = "" + local parsestring = string.ToTable(text) + local inquote = false + local argpart = 1 + print("Parseing: " .. text) + for k,v in pairs(parsestring) do + print("at " .. k .. ":" .. v) + if(v == " ") then + print("Hit delimiter") + if(inquote) then + args[argpart] = args[argpart] .. v + else + argpart = argpart + 1 + args[argpart] = "" + end + elseif(v == "\"") then + print("Hit quote") + inquote = !inquote + else + print("Adding to string") + args[argpart] = args[argpart] .. v + end + end + print("Finished, args:") + PrintTable(args) + --local args = string.Explode( " ", text ) if ( args == nil ) then args = {} end if ( teamonly ) then |
