Skip to content

GetDisplayByIndex(integer)

The GetDisplayByIndex Lua function returns a handle to the display object matching the provided index number.

  • Integer:
    This function needs an index number for one of the displays.
  • Handle:
    The returned handle to the display object.

This example prints the data connected to the handle. It uses the Dump() function:

The Dump() function returns a string with information about the object, for instance, the name, class, path of the object, its properties, and children.

Learn more in the Dump() topic.

Copy CodeLua
```
return function()
-- Get the index number for "Display 1"
local displayIndex = GetDisplayCollect()["Display 1"].INDEX
-- return error text in case the index number is nil
if displayIndex == nil then
ErrPrintf('Something went wrong. It appears that there is no "display 1"')
return
end
-- Dump all information about the display with the index number
Printf("=============== START OF DUMP ===============")
GetDisplayByIndex(displayIndex):Dump()
Printf("================ END OF DUMP ================")

end

## Subtopics
- [GetDisplayCollect() topic](/grandma3/2-4/lua_objectfree_getdisplaycollect/)