Skip to content

6. Addons

atom0s edited this page Apr 11, 2018 · 4 revisions

What are Addons?

Addons are Lua based scripts that act similar to plugins, but are instead written in Lua. In order to make use of addons, you must first have the Addons plugin (Addons.dll) loaded within rMod. (This plugin is loaded by default with the main rMod package.)

Important Note! It is important to note, addons operate in their OWN Lua states. These ARE NOT connected to the games Lua state in any manner! Each addon is loaded in its own Lua state as well, consider them sandboxed. This is so if one addon errors, it will not kill the other addons.

Developing Addons

Addons are developed in a similar manner to plugins but due to being Lua based scripts, there are some differences. Addons are able to see all of the various plugin interface event calls just like a plugin, however you must 'register' to those events in order to see them.

Addons also include a handful of helpful libraries and such included with the rMod package which can be found within:

  • /addons/libs/

These libraries include various things such as:

  • Extensions to the existing Lua functionality. (Math, Strings, Tables, etc.) [Found in /addons/libs/extensions/]
  • rMod specific related libraries. [Found in /addons/libs/hook/]
  • Json file parsing and creation for managing addon settings. [Found in /addons/libs/json/]
  • Kingdoms of Amalur related libraries. [Found in /addons/libs/reckoning/]
  • LuaSocket related libraries for web access from an addon. [Found in /addons/libs/socket]

Addons can include a common library file to include most of the listed above things instead of having to individually include each file manually:

require 'common';

Example Addon Source Code

If you are interested in working on an addon, you can find the example addon, as well as any other known addon, within our addon repository here:

Specifically, for the example addon, check here:

New To Lua / Lua Beginners Guides

Here is a collection of links related to Lua to help get you started with Lua scripted. Please note, because rMod's Addons plugin does do some custom things, some of what is available in rMod wont be found within these links.

You can find the full Lua manual here: (rMod's addon plugin makes use of Lua 5.1.)

Programming in Lua (Ebook): http://www.lua.org/pil/contents.html

Tip and Tricks / Performance Information

Metatables

Examples / Tutorials

You can’t perform that action at this time.