Custom element registration

This commit is contained in:
2026-07-12 23:47:59 -05:00
parent 7f1c94f6a9
commit 5e485a9c43
9 changed files with 150 additions and 1 deletions

View File

@@ -0,0 +1,28 @@
TestPage = {}
local maxHp = 100
local currentHp = 100
function TestPage.Damage(event)
currentHp = currentHp - 5
local document = event.current_element.owner_document
local target = document:GetElementById("hp-bar")
if target then
target:SetAttribute("current", currentHp)
end
end
function TestPage.Heal(event)
currentHp = currentHp + 5
local document = event.current_element.owner_document
local target = document:GetElementById("hp-bar")
if target then
target:SetAttribute("current", currentHp)
end
end