getFieldInfo(name)

Return detailed information about field (source)

The list of valid sources is available:

OpenTX Version

Radio

2.0

2.1

2.2

@status current Introduced in 2.0.8, 'unit' field added in 2.2.0

Parameters

  • name (string) name of the field

Return value

  • table information about requested field, table elements:

    • id (number) field identifier

    • name (string) field name

    • desc (string) field description

    • 'unit' (number) unit identifier Full list

  • nil the requested field was not found

Examples

general/getFieldInfo-example

local function run(e)
  local fieldinfo = getFieldInfo('rs')
  lcd.clear()
  lcd.drawText(1,1,"getFieldInfo() example",0)
  if fieldinfo then 
    lcd.drawText(1,11,"id: ", 0)
    lcd.drawText(lcd.getLastPos()+2,11,fieldinfo['id'],0)
    lcd.drawText(1,21,"name: ", 0)
    lcd.drawText(lcd.getLastPos()+2,21,fieldinfo['name'],0)
    lcd.drawText(1,31,"desc: ", 0)
    lcd.drawText(lcd.getLastPos()+2,31,fieldinfo['desc'],0)
  else
    lcd.drawText(1,11,"Requested field not available!", 0)    
  end
end

return{run=run}

Last updated