Difference between revisions of "Lua:getPixel"

From Cheat Engine
Jump to navigation Jump to search
m (moved getPixel to Lua:getPixel)
Line 1: Line 1:
 
[[Category:Lua]]
 
[[Category:Lua]]
'''function''' getPixel(''x'', ''y'')
+
{{CodeBox|'''function''' getPixel(''x'', ''y'') ''':''' integer}}
  
Returns the RGB value of the provided pixel in screen coordinates
+
Returns the RGB value of the pixel at the specified screen coordinate.
  
 
===Function Parameters===
 
===Function Parameters===
{|width="85%" cellpadding="10%" cellpadding="5%" cellspacing="0" border="0"
+
{|width="85%" cellpadding="10%" cellspacing="0" border="0"
 
!align="left"|Parameter
 
!align="left"|Parameter
 
!align="left"|Type
 
!align="left"|Type
Line 12: Line 12:
 
|x
 
|x
 
|Integer
 
|Integer
|The x coordinate to get the pixel of
+
|The X coordinate of the screen pixel.
 
|-
 
|-
 
|y
 
|y
 
|Integer
 
|Integer
|The y coordinate to get the pixel of
+
|The Y coordinate of the screen pixel.
 
|}
 
|}
  
 +
===Returns===
 +
integer — The RGB value of the pixel at the specified screen coordinate.
 +
 +
===Examples===
 +
 +
<pre>
 +
local color = getPixel(100, 100)
 +
print(string.format("Pixel color: #%X", color))
 +
</pre>
  
 
{{LuaSeeAlso}}
 
{{LuaSeeAlso}}

Revision as of 03:54, 21 June 2026

<> Lua API Reference

function getPixel(x, y) : integer

Returns the RGB value of the pixel at the specified screen coordinate.

Function Parameters

Parameter Type Description
x Integer The X coordinate of the screen pixel.
y Integer The Y coordinate of the screen pixel.

Returns

integer — The RGB value of the pixel at the specified screen coordinate.

Examples

local color = getPixel(100, 100)
print(string.format("Pixel color: #%X", color))

Main Pages

Core Lua documentation entry points

Lua
Script Engine