# Command:add\_arg

> #### [Command](https://sam.goobie.me/api/command/command) [Command](https://sam.goobie.me/api/command/command):add\_arg( [string](https://wiki.facepunch.com/gmod/string) argument\_name, *(*[*optional*](https://sam.goobie.me/info-read/optional)*)* [table](https://wiki.facepunch.com/gmod/table) data *= {}* )

## Description

Adds argument to be used with the command.

## Aguments

1. #### [string](https://wiki.facepunch.com/gmod/string) argument\_name
2. #### *(*[*optional*](https://sam.goobie.me/info-read/optional)*)* [table](https://wiki.facepunch.com/gmod/table) data *= {}*

   data table is used for arguments to know how it should work, check examples.

## Returns

1. #### [Command](https://sam.goobie.me/api/command/command)

## Example

```lua
local kick_command = sam.Command.get("kick")
kick_command:add_arg("text", {
    -- optional field is used by core to know if this command is optional or not
    optional = true,
    
    -- text argument has these options:
    -- hint : string : defaut = "text"
    -- check : bool function(input: string, player: Player)
    hint = "meow meoew hint",
    check = function(ply_input, ply)
        return ply_input == "true"
    end
})
```
