Lua:Class:Object
(Redirected from Object)
Jump to navigation
Jump to search
The Object class is the base class for Lua-exposed Cheat Engine objects.
It provides basic class information, field and method address lookup helpers, and object destruction.
Contents
Inheritance[edit]
| Class | Inherits From | Description |
|---|---|---|
| Object | None | Base class for Lua-exposed objects. |
Properties[edit]
| Property | Type | Description |
|---|---|---|
| ClassName | String | The name of the object's class. Read-only. |
Methods[edit]
| Method | Return Type | Description |
|---|---|---|
| getClassName() | String | Returns the class name of the object. |
| fieldAddress(fieldname) | Integer | Returns the address of the specified field. |
| methodAddress(methodname) | Integer | Returns the address of the specified method. |
| methodName(address) | String | Returns the method name for the specified method address. |
| destroy() | void | Destroys the object. |
Examples[edit]
Read the ClassName property[edit]
1 local form = createForm(false)
2
3 print(form.ClassName)
4
5 form.destroy()
Use getClassName[edit]
1 local form = createForm(false)
2
3 local className = form.getClassName()
4
5 print(className)
6
7 form.destroy()
Check an object's class[edit]
1 local form = createForm(false)
2
3 if form.getClassName() == "TCEForm" then
4 print("This is a Cheat Engine form")
5 end
6
7 form.destroy()
Get the address of a field[edit]
1 local form = createForm(false)
2
3 local address = form.fieldAddress("FName")
4
5 if address ~= nil and address ~= 0 then
6 print(string.format("%X", address))
7 end
8
9 form.destroy()
Get the address of a method[edit]
1 local form = createForm(false)
2
3 local address = form.methodAddress("Show")
4
5 if address ~= nil and address ~= 0 then
6 print(string.format("%X", address))
7 end
8
9 form.destroy()
Get a method name from an address[edit]
1 local form = createForm(false)
2
3 local address = form.methodAddress("Show")
4
5 if address ~= nil and address ~= 0 then
6 local name = form.methodName(address)
7
8 print(name)
9 end
10
11 form.destroy()
Destroy an object[edit]
1 local form = createForm(false)
2
3 form.Caption = "Temporary Form"
4
5 form.destroy()
Destroy an object after use[edit]
1 local font = createFont()
2
3 font.Name = "Consolas"
4 font.Size = 12
5
6 print(font.Name)
7
8 font.destroy()