User Tools

Site Tools


This is an old revision of the document!

Using The AshitaCore Object

What is the AshitaCore Object?

The AshitaCore object (IAshitaCore) is the main object created inside of the Ashita hook. This object is exposed to plugins, including Addons, which in turn is then exposed to Lua via custom exposure methods and the combined efforts of Luabind. This is the main object used to interact with the Ashita hook.

Inside of addons, this object is named and accessible via: AshitaCore

Using AshitaCore

Making use of AshitaCore is very simple and similar to other languages. AshitaCore is created from a class object inside of C++. This means that calls are considered __thiscall. What this means is that the calling convention used (__thiscall) makes use of an object while making the call to the desired function. For example, take this C++ code:

class Derp
    void HelloWorld();

auto x = new Derp();
delete x;

This example code shows creating a class called Derp, making an instance of it named 'x', and then invoking the 'HelloWorld' function. Because 'x' is an instance of Derp, we use the → operator to invoke the function. In Lua, → is represented by : instead.

You can learn more about the differences between . and : in Lua here:

In Lua, metatables are used to mimic a style of object-oriented coding.

Lets take for example, inside of the IAshitaCore interface, we have a function:

virtual HMODULE GetHandle(void) const = 0;

In C++, this would be invoked like this:

auto handle = coreObject->GetHandle();

In Lua, we would call it like this:

local handle = AshitaCore:GetHandle();

By using the : operator in Lua, we are automatically informing the interpreter that on the left side of the : (in this case, AshitaCore) our object to invoke the GetGameHwnd with is AshitaCore. This can also be called like this:

local handle = IAshitaCore.GetHandle(AshitaCore);

However, in this case, it is not as elegant as the first.

What's Exposed From AshitaCore?

  • IAshitaCore
    • GetChatManager
    • GetConfigurationManager
    • GetDataManager
    • GetFontManager
    • GetGuiManager
    • GetInputManager
    • GetPacketManager
    • GetPluginManager
    • GetPointerManager
    • GetResourceManager
    • GetHandle
    • GetAshitaInstallPath
    • GetMouseUnhooked
    • SetMouseUnhooked
    • GetD3DFillMode
    • GetD3DAmbientEnabled
    • GetD3DAmbientColor
    • SetD3DFillMode
    • SetD3DAmbientEnabled
    • SetD3DAmbientColor
    • GetAllowGamepadInBackground
    • SetAllowGamepadInBackground
  • IChatManager
    • QueueCommand
    • AddChatMessage
    • RunScript
    • GetInputText
    • SetInputText
    • IsInputOpen
    • Write
  • IConfigurationManager
    • Load
    • Save
    • Remove
    • set_value
    • get_string
    • get_bool
    • get_uint8
    • get_uint16
    • get_uint32
    • get_uint64
    • get_int8
    • get_int16
    • get_int32
    • get_int64
    • get_float
    • get_double
  • IKeyboard
    • BindKey
    • UnbindKey
    • UnbindAll
    • IsKeyBound
    • ListBinds
    • V2D
    • D2V
    • S2D
    • D2S
    • GetParentWindow
    • GetBlocked
    • SetBlocked
  • IMouse
    • GetParentWindow
    • GetBlocked
    • SetBlocked
  • IInputManager
    • GetKeyboard
    • GetMouse
  • ILogManager
    • Log
  • IPacketManager
    • No functions are directly exposed, instead, they are global functions.
  • IPluginManager
    • GetPluginCount
  • IPointerManager
    • GetPointer
addons/using_ashitacore.1492850976.txt.gz · Last modified: 2017/04/22 01:49 by atom0s