Add panel:get_info()

This commit is contained in:
Zughy 2023-08-23 16:48:38 +02:00
parent c02d7ba31a
commit 4503417438
2 changed files with 20 additions and 7 deletions

View File

@ -39,6 +39,9 @@ Install it as any other mod `¯\_(ツ)_/¯`
## 2.1. Functions
* `new({params})`: creates a new panel
* `get_info()`: returns a table containing the following fields:
* `bg`: (table) a copy of the HUD of the background (with MT values such as `hud_elem_type`, `position`, `scale` etc.)
* `title`: (table) same as `bg` but for the title HUD
* `show()`: makes the panel appear
* `hide()`: makes the panel disappear (but it's still assigned to the player)
* `is_visible()`: whether the panel is currently displayed

10
api.lua
View File

@ -305,6 +305,16 @@ end
function Panel:get_info()
local info = {}
info.bg = table.copy(self.background_def)
info.title = table.copy(self.title_def)
return info
end
function Panel:is_visible()
return self.visible
end