add API documentation for modding extension

This commit is contained in:
Tai @ Flex 2016-11-26 12:33:27 +00:00
parent 77a30f9e05
commit 70ed7e34a0
1 changed files with 21 additions and 0 deletions

21
api.md Normal file
View File

@ -0,0 +1,21 @@
# API Extension
Adding your protections to the HUD
----------------------------------
If you are providing an extra protection mod to work in cunjunction with the
HUD feature of `areas`, you can register a callback to add your mod's code to
display your protection's existence. For example
local myhandler = function(pos,arealist)
local areaowner = find_my_protections(pos)
if areaowner then
arealist["mymodname"] = {
name = "Protection name",
owner = areaowner,
}
end
end
areas.register_hud_handler(myhandler)