attemp to perform arithmetic on local

Study the LUA day 3 and ran into a problem when writing a command to kick…
How to fix it?

Console:



Hook 'Admin Kick' Failed: [gamemodes\bek\gamemode\cl_commands.lua:12] attempt to perform arithmetic on local 'comp' (a string value)
Bek1zo: !kick bek1zo


file cl:commands.lua



hook.Add("OnPlayerChat", "Admin Kick", function( ply, strText, bTeamOnly, bPlayerIsDead )
    if !ply:IsAdmin() and !ply:IsSuperAdmin() then return end
    local args = string.Explode(" ", strText)
    local comp = ""
     
    if args[1] != "!kick" then return end
     
    for _,v in pairs(args) do
        if v != args[1] then
            comp = comp + v
        end
    end
     
    if comp != "" then
        RunConsoleCommand("kick", comp)
    end
end)


You can’t add numbers to a string.

but where numbers here?
" comp = comp + v "

You’re performing arithmetic on a string.

[lua]comp = comp … v[/lua]

Thanks, but now another problem, the “!kick” is not erased…



Bek1zo: !kick bek1zo
name "!kickbek1zo" not found


return true when the !kick if statement is called.
[lua]
hook.Add(“OnPlayerChat”, “Admin Kick”, function( ply, strText, bTeamOnly, bPlayerIsDead )
if !ply:IsAdmin() and !ply:IsSuperAdmin() then return end
local args = string.Explode(" ", strText)
local comp = “”

if args[1] != "!kick" then return end
 
for _,v in pairs(args) do
    if v != args[1] then
        comp = comp .. v
    end
end
 
if comp != "" then
    RunConsoleCommand("kick", comp)
end
return true

end)[/lua]

Thanks, it work!