Skip to content
S3ctor’s S3cret St4sh
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. An unsized meter uses a 150x18 default size.

Example

local ui = require 'openmw.ui'
local util = require 'openmw.util'
local H3UI = require('openmw.interfaces').H3UI

ui.create {
  type = ui.TYPE.Container,
  layer = 'Windows',
  content = ui.content {
    H3UI.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