User Tools

Site Tools


addons:functions:memory

Memory Namespace

The memory namespace contains functions that interact with the game clients memory.

You can access these functions via:

ashita.memory.


ashita.memory.get_baseaddr

ashita.memory.get_base

Obtains the base address of a module.

number ashita.memory.get_base(name);

  • Parameters
    • name - (string) The name of the module to obtain the base address of.
  • Returns
    • number - The base address if valid, 0 otherwise.

ashita.memory.get_modulesize

ashita.memory.get_size

Obtains the size of a module.

number ashita.memory.get_size(name);

  • Parameters
    • name - (string) The name of the module to obtain the size of.
  • Returns
    • number - The size if valid, 0 otherwise.

ashita.memory.unprotect_memory

ashita.memory.unprotect

Unprotects an area of memory, setting its page access to 'PAGE_EXECUTE_READWRITE'.

bool ashita.memory.unprotect(addr, size);

  • Parameters
    • addr - (number) The starting address to unprotect.
    • size - (number) The size of data to unprotect.
  • Returns
    • bool - True on success, false otherwise.

ashita.memory.allocate_memory

ashita.memory.allocate

ashita.memory.alloc

Allocates an area of memory.

number ashita.memory.alloc(size);

  • Parameters
    • size - (number) The size of data to allocate.
  • Returns
    • number - The base address of the new allocation on success, nil otherwise.

ashita.memory.deallocate_memory

ashita.memory.deallocate

ashita.memory.dealloc

Deallocates an area of memory.

bool ashita.memory.dealloc(addr, size);

  • Parameters
    • addr - (number) The base address of the memory to deallocate.
    • size - (number) The size of data to deallocate.
  • Returns
    • bool - True on success, false otherwise.

ashita.memory.findpattern

ashita.memory.find

Scans memory for a given pattern.

number ashita.memory.find(baseAddress, size, pattern, offset, usage);

  • Parameters
    • baseAddress - (number) The base address of the memory to scan within.
    • size - (number) The size of data to scan within.
    • pattern - (string) The pattern to scan for.
    • offset - (number) The offset to add to the result, if found.
    • usage - (number) The usage count to use if the pattern is expected to be found more than once.
  • Returns
    • number - The address where the pattern was found on success, 0 otherwise.

number ashita.memory.find(moduleName, size, pattern, offset, usage);

  • Parameters
    • moduleName - (string) The name of the module to scan within. (Using this method of this function will use the base and size of the module automatically.)
    • size - (number) Unused, this can be left 0 when using this style of the method.
    • pattern - (string) The pattern to scan for.
    • offset - (number) The offset to add to the result, if found.
    • usage - (number) The usage count to use if the pattern is expected to be found more than once.
  • Returns
    • number - The address where the pattern was found on success, 0 otherwise.

ashita.memory.read_uint8

Reads a value from memory at the given address.

number ashita.memory.read_uint8(addr);

  • Parameters
    • addr - (number) The address to read the value of.
  • Returns
    • number - The value of the address, 0 on error.

ashita.memory.read_uint16

Reads a value from memory at the given address.

number ashita.memory.read_uint16(addr);

  • Parameters
    • addr - (number) The address to read the value of.
  • Returns
    • number - The value of the address, 0 on error.

ashita.memory.read_uint32

Reads a value from memory at the given address.

number ashita.memory.read_uint32(addr);

  • Parameters
    • addr - (number) The address to read the value of.
  • Returns
    • number - The value of the address, 0 on error.

ashita.memory.read_uint64

Reads a value from memory at the given address.

number ashita.memory.read_uint64(addr);

  • Parameters
    • addr - (number) The address to read the value of.
  • Returns
    • number - The value of the address, 0 on error.

ashita.memory.read_int8

Reads a value from memory at the given address.

number ashita.memory.read_int8(addr);

  • Parameters
    • addr - (number) The address to read the value of.
  • Returns
    • number - The value of the address, 0 on error.

ashita.memory.read_int16

Reads a value from memory at the given address.

number ashita.memory.read_int16(addr);

  • Parameters
    • addr - (number) The address to read the value of.
  • Returns
    • number - The value of the address, 0 on error.

ashita.memory.read_int32

Reads a value from memory at the given address.

number ashita.memory.read_int32(addr);

  • Parameters
    • addr - (number) The address to read the value of.
  • Returns
    • number - The value of the address, 0 on error.

ashita.memory.read_int64

Reads a value from memory at the given address.

number ashita.memory.read_int64(addr);

  • Parameters
    • addr - (number) The address to read the value of.
  • Returns
    • number - The value of the address, 0 on error.

ashita.memory.read_float

Reads a value from memory at the given address.

number ashita.memory.read_float(addr);

  • Parameters
    • addr - (number) The address to read the value of.
  • Returns
    • number - The value of the address, 0 on error.

ashita.memory.read_double

Reads a value from memory at the given address.

number ashita.memory.read_double(addr);

  • Parameters
    • addr - (number) The address to read the value of.
  • Returns
    • number - The value of the address, 0 on error.

ashita.memory.read_array

Reads a value from memory at the given address.

number ashita.memory.read_array(addr, size);

  • Parameters
    • addr - (number) The address to read the value of.
    • size - (number) The size of data to read.
  • Returns
    • table - The values read from the given address, nil on error.

ashita.memory.read_string

Reads a value from memory at the given address.

number ashita.memory.read_string(addr, size);

  • Parameters
    • addr - (number) The address to read the value of.
    • size - (number) The size of the string to read.
  • Returns
    • string - The string read from the given address, nil on error.

ashita.memory.write_uint8

Writes a value to memory at the given address.

void ashita.memory.write_uint8(addr, value);

  • Parameters
    • addr - (number) The address to write the value to.
    • value - (number) The value to write to memory.
  • Returns
    • Function does not return a value.

ashita.memory.write_uint16

Writes a value to memory at the given address.

void ashita.memory.write_uint16(addr, value);

  • Parameters
    • addr - (number) The address to write the value to.
    • value - (number) The value to write to memory.
  • Returns
    • Function does not return a value.

ashita.memory.write_uint32

Writes a value to memory at the given address.

void ashita.memory.write_uint32(addr, value);

  • Parameters
    • addr - (number) The address to write the value to.
    • value - (number) The value to write to memory.
  • Returns
    • Function does not return a value.

ashita.memory.write_uint64

Writes a value to memory at the given address.

void ashita.memory.write_uint64(addr, value);

  • Parameters
    • addr - (number) The address to write the value to.
    • value - (number) The value to write to memory.
  • Returns
    • Function does not return a value.

ashita.memory.write_int8

Writes a value to memory at the given address.

void ashita.memory.write_int8(addr, value);

  • Parameters
    • addr - (number) The address to write the value to.
    • value - (number) The value to write to memory.
  • Returns
    • Function does not return a value.

ashita.memory.write_int16

Writes a value to memory at the given address.

void ashita.memory.write_int16(addr, value);

  • Parameters
    • addr - (number) The address to write the value to.
    • value - (number) The value to write to memory.
  • Returns
    • Function does not return a value.

ashita.memory.write_int32

Writes a value to memory at the given address.

void ashita.memory.write_int32(addr, value);

  • Parameters
    • addr - (number) The address to write the value to.
    • value - (number) The value to write to memory.
  • Returns
    • Function does not return a value.

ashita.memory.write_int64

Writes a value to memory at the given address.

void ashita.memory.write_int64(addr, value);

  • Parameters
    • addr - (number) The address to write the value to.
    • value - (number) The value to write to memory.
  • Returns
    • Function does not return a value.

ashita.memory.write_float

Writes a value to memory at the given address.

void ashita.memory.write_float(addr, value);

  • Parameters
    • addr - (number) The address to write the value to.
    • value - (number) The value to write to memory.
  • Returns
    • Function does not return a value.

ashita.memory.write_double

Writes a value to memory at the given address.

void ashita.memory.write_double(addr, value);

  • Parameters
    • addr - (number) The address to write the value to.
    • value - (number) The value to write to memory.
  • Returns
    • Function does not return a value.

ashita.memory.write_array

Writes a value to memory at the given address.

void ashita.memory.write_array(addr, value);

  • Parameters
    • addr - (number) The address to write the value to.
    • value - (table) The array of data to write to memory.
  • Returns
    • Function does not return a value.

ashita.memory.write_string

Writes a value to memory at the given address.

void ashita.memory.write_string(addr, value);

  • Parameters
    • addr - (number) The address to write the value to.
    • value - (string) The value to write to memory.
  • Returns
    • Function does not return a value.
addons/functions/memory.txt · Last modified: 2017/04/22 00:03 by atom0s