Difference between revisions of "Lua:getPixel"
Jump to navigation
Jump to search
m (Syntax Highlighting.) |
|||
| (3 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
[[Category:Lua]] | [[Category:Lua]] | ||
| − | '''function''' getPixel(''x'', ''y'') | + | {{CodeBox|'''function''' getPixel(''x'', ''y'') ''':''' integer}} |
| − | Returns the RGB value of the | + | Returns the RGB value of the pixel at the specified screen coordinate. |
===Function Parameters=== | ===Function Parameters=== | ||
| − | {|width="85%" cellpadding="10 | + | {|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 | + | |The X coordinate of the screen pixel. |
|- | |- | ||
|y | |y | ||
|Integer | |Integer | ||
| − | |The | + | |The Y coordinate of the screen pixel. |
|} | |} | ||
| + | ===Returns=== | ||
| + | integer — The RGB value of the pixel at the specified screen coordinate. | ||
| − | == | + | ===Examples=== |
| − | + | ||
| + | <syntaxhighlight lang="lua" line> | ||
| + | local color = getPixel(100, 100) | ||
| + | print(string.format("Pixel color: #%X", color)) | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | {{LuaSeeAlso}} | ||
Latest revision as of 20:29, 25 June 2026
Returns the RGB value of the pixel at the specified screen coordinate.
Function Parameters[edit]
| Parameter | Type | Description |
|---|---|---|
| x | Integer | The X coordinate of the screen pixel. |
| y | Integer | The Y coordinate of the screen pixel. |
Returns[edit]
integer — The RGB value of the pixel at the specified screen coordinate.
Examples[edit]
1 local color = getPixel(100, 100)
2 print(string.format("Pixel color: #%X", color))