Navigation
Addons
Plugins
Navigation
Addons
Plugins
Addons are Lua scripts that get loaded into the game via the Addons.dll plugin. These scripts have acces to the Ashita core interfaces that plugins can make use of, allowing scripts to essentially be, compileless plugins. (With limitations of course.)
Addons let you extend the game through means of Lua scripting.
Lua is a powerful, fast, lightweight, embedded scripting language.
Lua combines simple procedural syntax with powerful data description constructs based on associative arrays and extensible semantics. Lua is dynamically typed, runs by interpreting bytecode for a register-based virtual machine, and has automatic memory management with incremental garbage collection, making it ideal for configuration, scripting, and rapid prototyping.
You can read and learn more about Lua at their homepage here: http://www.lua.org/about.html
Here is a collection of links to help get you started with Lua.
You can find the full Lua manual here: (Ashita makes use of Lua 5.1)
Programming In Lua (EBook): http://www.lua.org/pil/contents.html
Tips and Tricks / Performance Information
Metatables
Examples / Tutorials
The addons plugin can be loaded via the typical plugin load command:
By default, Addons.dll will be automatically loaded via the Default.txt script.
You can use the following commands to interact with the plugin:
Lua creates an object called a state when you begin using it. However, this state is fragile and does not offer much protection against errors and problems. Because of this, every single addon that you load is ran inside of its own Lua state. By doing this, it helps prevent addons from conflicting and causing others to crash. If 1 addon has a problem, it simply is set to an error state and no longer receives events. Rather then causing all addons to mess up, only one is removed.
However this does come with a drawback. Addons cannot directly communicate with each other.
This is where the libs folder comes in handy. Commonly used functions and such can be placed inside of the libs folder allowing all plugins to access them. This does not mean that plugins can talk to each other using this folder, it is simply a location where commonly used things can be put to allow all addons to access them.
If you land up needing to have addons communicate, you can make use of the command system. Have one addon invoke a command to be processed, and in another addon, handle that command.