Make API intro a bit clearer

master
Wuzzy 2016-12-27 22:56:56 +01:00
parent 88e3d6f6da
commit 3c38635f03
1 changed files with 9 additions and 5 deletions

14
API.md
View File

@ -1,8 +1,9 @@
# API documentation for [`sfinv_buttons`]
Use this API to add your own buttons to the page.
Use this very API to add your own buttons to the new tab. There is only
one function: `sfinv_buttons.register_button`.
## `sfinv_buttons.register_button(name, def)
## `sfinv_buttons.register_button(name, def)`
* `name`: Unique button identifier
* `def`: Coniguration table (see below)
@ -12,7 +13,8 @@ Use this API to add your own buttons to the page.
* `action(player)`: Function is called when button is triggered
* `player`: ObjectRef to player who triggered the button
* Default: Nothing happens
* `tooltip: A tooltip for the button (optional, only use it for an additional, non-critical explanation)
* `tooltip: A tooltip for the button (optional, only use it for an additional,
non-critical explanation)
* `image`: Texture name for the image to show left of the button (optional)
* `show(player)`: Shall return `true` if the button should be displayed (optional)
* `player`: ObjectRef to player who triggered the button
@ -21,6 +23,8 @@ Use this API to add your own buttons to the page.
## Recommendations
* Try to summarize the most important information on the button
* Test if the button title still fits when having >= 9 and <= 18 buttons at a resolution of 800×600
* It is recommended to only add buttons to access core mod functionality and not for every minor feature. The rule of thumb is to add at most 1 button per mod
* Test if the button title still fits when having >= 9 and <= 18 buttons at a
resolution of 800×600
* It is recommended to only add buttons to access core mod functionality and
not for every minor feature. The rule of thumb is to add at most 1 button per mod
* If you like to add many buttons, consider adding your own `sfinv` page instead