Update API

This commit is contained in:
raymoo 2016-05-26 07:58:16 -07:00
parent 9150eb12d2
commit b9c56d6a6d
1 changed files with 10 additions and 13 deletions

23
API.md
View File

@ -42,10 +42,6 @@ key order. It should be equivalent to using ```combine``` to combine all the
values together. For example, ```combine``` could multiply two speed multipliers values together. For example, ```combine``` could multiply two speed multipliers
together, and ```fold``` could multiply every value together. together, and ```fold``` could multiply every value together.
If you only define one of the two, the undefined one will be defined in terms of
the one that is defined. However, it is better to define both for performance
reasons.
identity identity
-------- --------
```identity```, when combined with any other value, should result in the other ```identity```, when combined with any other value, should result in the other
@ -66,14 +62,15 @@ used to make changes to the player state. Returns a monoid.
Monoid Methods Monoid Methods
-------------- --------------
```monoid:add_change(player, value[, id])``` - Applies the change represented by ```monoid:add_change(player, value[, "id"])``` - Applies the change represented
```value``` to ```player```. Returns an ID for the change. If the optional by ```value``` to ```player```. Returns an ID for the change. If the optional
argument ```id``` is supplied, that is used as the ID instead, and any existing string argument ```"id"``` is supplied, that is used as the ID instead, and any
change with that ID is removed. existing change with that ID is removed. IDs are only guaranteed to be unique
per-player. Conversely, you are allowed to make multiple changes with the same
ID as long as they are all on different players.
```monoid:del_change(id)``` - Removes the change with the given ID, if ```monoid:del_change(player, id)``` - Removes the change with the given ID, from
it exists. the given player, if it exists.
Monoid Properties ```monoid:value(player)``` - The current combined value of the monoid for the
----------------- given player.
```monoid.value``` - The current combined value of the monoid.