H3lp Yours3lfDocs
api

meter

Show a bounded horizontal fill and empty indicator.

Builds a bordered Widget with fill and empty Image children. value / max is clamped to 0..1; max <= 0 produces an empty meter.

Example

local ui = require 'openmw.ui'
local util = require 'openmw.util'
local meter = require 'scripts.s3.components.meter'

ui.create {
  type = ui.TYPE.Container,
  layer = 'Windows',
  content = ui.content {
    meter {
      value = 65,
      max = 100,
      props = {
        size = util.vector2(240, 18),
      },
    },
  },
}

Parameters

FieldTypeDescription
valuenumber?Current fill value; defaults to 0.
maxnumber?Full-scale value; defaults to 1.
fillPropstable?Properties for the filled image.
emptyPropstable?Properties for the empty image.
templateopenmw.ui.Template?Replaces the default H3UI meter template.

Common layout fields are documented on the UI Components overview. The ratio is calculated during construction; rebuild or update child image layouts when it changes.

See also

slider · itemSlot · image