Module ...

Handles actors stats

Functions

_M:defineStat (name, short_name, default_value, min, max, desc) Defines stats Static!
_M:getStat (stat, scale, raw, no_inc) Gets a stat value Not that the engine also auto-defines stat specific methods on the form: self:getShortname().
_M:incIncStat (stat, val) Increases a stat additional value
_M:incStat (stat, val) Increases a stat
_M:init (t) Initialises stats with default values if needed
_M:isStatMax (stat) Is the stat maxed ?
_M:onStatChange (stat, v) Notifies a change of stat value


Functions

_M:defineStat (name, short_name, default_value, min, max, desc)
Defines stats Static!

Parameters

  • name:
  • short_name:
  • default_value:
  • min:
  • max:
  • desc:
_M:getStat (stat, scale, raw, no_inc)
Gets a stat value Not that the engine also auto-defines stat specific methods on the form: self:getShortname(). If you stat short name is STR then it becomes getStr()

Parameters

  • stat: the stat id
  • scale: a scaling factor, nil means max stat value
  • raw: false if the scaled result must be rounded down
  • no_inc: if true it wont include stats gained by self.inc_stats
_M:incIncStat (stat, val)
Increases a stat additional value

Parameters

  • stat: the stat id to change
  • val: the increment to add/subtract
_M:incStat (stat, val)
Increases a stat

Parameters

  • stat: the stat id to change
  • val: the increment to add/subtract
_M:init (t)
Initialises stats with default values if needed

Parameters

  • t:
_M:isStatMax (stat)
Is the stat maxed ?

Parameters

  • stat:
_M:onStatChange (stat, v)
Notifies a change of stat value

Parameters

  • stat:
  • v:

Valid XHTML 1.0!