Lua:getWindowCaption

From Cheat Engine
Jump to navigation Jump to search

<> Lua API Reference

function getWindowCaption(windowhandle) : string

Returns the caption text of a window.

The window is identified by its window handle.

Function Parameters

Parameter Type Description
windowhandle Integer The handle of the window whose caption should be returned.

Returns

String — The caption text of the specified window.

Examples

1 local form = createForm()
2 form.Caption = "Example Window"
3 
4 local caption = getWindowCaption(form.Handle)
5 
6 print(caption)
1 local mainForm = getMainForm()
2 
3 if mainForm ~= nil then
4   local caption = getWindowCaption(mainForm.Handle)
5   print("Main form caption: " .. tostring(caption))
6 end
1 local memoryView = getMemoryViewForm()
2 
3 if memoryView ~= nil then
4   print(getWindowCaption(memoryView.Handle))
5 end

Notes

  • The function requires a valid window handle.
  • For Cheat Engine controls and forms, the Handle property can usually be used.
  • For normal Cheat Engine form objects, reading the Caption property directly is usually simpler.

Main Pages

Core Lua documentation entry points

Lua
Script Engine

Form Related Classes