local Health = {}
Health.__index = Health
function Health.new(max) return setmetatable({ max = max, current = max }, Health) end
function Health:heal(n)
    self.current = self.current + n
    if self.current > self.max then self.current = self.max end
end
function Health:damage(n)
    self.current = self.current - n
    if self.current < 0 then self.current = 0 end
end
function Health:get() return self.current end

local h = Health.new(100)
h:damage(30); print(h:get())
h:heal(1000); print(h:get())
h:damage(9999); print(h:get())
