Lua:registerCustomTypeAutoAssembler

From Cheat Engine
Jump to navigation Jump to search

<> Lua API Reference

function registerCustomTypeAutoAssembler(script) : CustomType

Registers a custom type based on an Auto Assembler script.

The script must allocate and define both a ConvertRoutine and a ConvertBackRoutine. These routines are used to convert the raw bytes into a value and to convert a value back into bytes.

Function Parameters[edit]

Parameter Type Description
script String The Auto Assembler script used to define the custom type. The script must allocate ConvertRoutine and ConvertBackRoutine.

Returns[edit]

CustomType — The registered Custom Type object.

Required Routines[edit]

Routine Description
ConvertRoutine The routine that converts the raw bytes into the value shown by the custom type.
ConvertBackRoutine The routine that converts a value back into the bytes that should be written.

Examples[edit]

local script = [[
alloc(ConvertRoutine, 1024)
alloc(ConvertBackRoutine, 1024)

ConvertRoutine:
  // Add conversion code here
  ret

ConvertBackRoutine:
  // Add conversion-back code here
  ret
]]

local customType = registerCustomTypeAutoAssembler(script)

print("Registered custom type: " .. tostring(customType)) -- ??

Main Pages

Core Lua documentation entry points

Lua
Script Engine