Lua Basics

From Cheat Engine

(Redirected from Lua Basics)
Jump to: navigation, search


Lua interaction is done a few ways in Cheat Engine.

  1. You have the Lua Engine that you can access from the memory view form by selecting tools then selecting lua engine.
  2. There is a lua script associated with your cheat table that you access form the Cheat Engine main form menu by selecting table then select show cheat table lua script. You can also load and execute other lua scripts.
  3. Then there is making use of the {$lua} tag in an Auto Assembler script. You can open an auto assembler form from the Cheat Engine main form by pressing Ctrl+Alt+A.


Contents

[edit] Lua Engine

Form the Cheat Engine main form press Shift+Ctrl+Alt+L to open the Lua Engine form. The Lua Engine form contains a text box for lua's standard output (print calls use the standard output) as well as an interactive script box that you can directly execute lua script. You can open or save scripts from here.


[edit] Cheat table lua script

From the Cheat Engine main form press Ctrl+L, to open the cheat table lua script form.

This script is associated with the cheat table. By default when opening a cheat table file Cheat Engine will prompt you that the table has a table lua script and asking you if you want to execute it.

Note: You can change what Cheat Engine does with the cheat table Lua script in the Cheat Engine general settings.

From the cheat table lua script form menu you can select file then select new window to open new script windows.


[edit] Script windows

You can have as many script windows open as you want. If you save these scripts as lua files in the same directory as your cheat table. You can run them from other scripts using lua's require, which will only run a script the first time it's required, and dofile, which will run a script every time you call it. Note that you do not use the extension with require, ".lua" is assumed, but you do need it with dofile.

Code:

require('Script1') dofile('Script1.lua') require('Script1')

Output:

Script1 Executing... Script1 Executing...


[edit] See also

[edit] External links

[edit] Syntax Highlighter

Personal tools
Toolbox