hobj:field

LuaFAR for Editor

hobj:field


val = hobj:field (name)

Parameters:
  name   : sequence of dot-delimitered fields;

Returns:
  val    : value of the given nested field in history object hobj
           (will be created if absent).

Description:
  - hobj:field("key1.key2 ... keyN") returns the equivalent of
    hobj["key1"]["key2"]...["keyN"].

  - If at any stage of retrieving some intermediate nested field
    "keyM", its value is nil, then both that and all subsequent
    fields are created by assigning each of them a new table.

Example:

  if From == "e" then     hist = _Hist:field ("menu.editor")
  elseif From == "v" then hist = _Hist:field ("menu.viewer")
  elseif From == "p" then hist = _Hist:field ("menu.pluginsmenu")
  else return