Difference between revisions of "Lua:inModule"

From Cheat Engine
Jump to navigation Jump to search
m (moved inModule to Lua:inModule)
m (Examples: Syntax Highlight.)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
[[Category:Lua]]
 
[[Category:Lua]]
'''function''' inModule(''address'')
+
{{CodeBox|'''function''' inModule(''address'') ''':''' boolean}}
  
Returns true if the provided address resides inside a module (example: .exe or .dll)
+
Returns true if the given address is inside a module.
 
 
If errorOnLookupFailure is set to true (the default value), if you look up a symbol that does not exist, it will throw an error.  With errorOnLookupFailure set to false, it will return false.
 
  
 
===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 13: Line 11:
 
|-
 
|-
 
|address
 
|address
|[[CEAddressString]]
+
|Integer or [[CEAddressString]]
|The address to look up
+
|The address to check.
 
|}
 
|}
  
 +
===Returns===
 +
boolean — True if the given address is inside a module, otherwise false.
 +
 +
===Examples===
 +
<syntaxhighlight lang="lua" line highlight="3">
 +
local address = getAddress("KERNEL32.AddAtomA")
 +
 +
if inModule(address) then
 +
  print("The address is inside a module")
 +
else
 +
  print("The address is not inside a module")
 +
end
 +
</syntaxhighlight>
  
 
{{LuaSeeAlso}}
 
{{LuaSeeAlso}}
  
 
=== Related Functions ===
 
=== Related Functions ===
* [[inSystemModule]]
+
* [[Lua:inSystemModule|inSystemModule]]

Latest revision as of 00:46, 27 June 2026

<> Lua API Reference

function inModule(address) : boolean

Returns true if the given address is inside a module.

Function Parameters[edit]

Parameter Type Description
address Integer or CEAddressString The address to check.

Returns[edit]

boolean — True if the given address is inside a module, otherwise false.

Examples[edit]

1 local address = getAddress("KERNEL32.AddAtomA")
2 
3 if inModule(address) then
4   print("The address is inside a module")
5 else
6   print("The address is not inside a module")
7 end

Main Pages

Core Lua documentation entry points

Lua
Script Engine

Related Functions[edit]