Skip to content

Commit

Permalink
Add more param types
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenwardy committed Nov 26, 2018
1 parent 5d53449 commit 4cce1cd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,16 @@ A route is a string. Let's look at `move :target to :pos:pos`:

## Param Types

* `word` - default. Any string without spaces.
* `word` - default. Any string without spaces
* `number` - Any number, including decimals
* `int` - Any integer, no decimals
* `text` - Any string
* `pos` - 1,2,3 or 1.1,2,3.4567 or (1,2,3) or 1.2, 2 ,3.2
* `modname` - a mod name
* `alpha` - upper or lower alphabetic characters (A-Za-z)
* `alphascore` - above, but with underscores
* `alphanumeric` - upper or lower alphabetic characters and numbers (A-Za-z0-9)
* `username` - a valid username

## Registering new Paramtypes

Expand Down
5 changes: 5 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ ChatCmdBuilder.types = {
number = "(%-?[%d.]+)",
int = "(%-?[%d]+)",
word = "([^ ]+)",
alpha = "([A-Za-z]+)",
modname = "([a-z0-9_]+)",
alphascore = "([A-Za-z_]+)",
alphanumeric = "([A-Za-z0-9]+)",
username = "([A-Za-z0-9-_]+)",
}

function ChatCmdBuilder.build(func)
Expand Down

0 comments on commit 4cce1cd

Please sign in to comment.