MayronObjects

MayronObjects

2.8k Downloads

About

MayronObjects is a framework designed to make object-oriented programming (OOP) easier for Lua developers.
The framework is designed for World of Warcraft addon development and supports both Classic and Retail.

MayronObjects lets you:

  • Create classes and instantiate new instance objects modeled from those classes.
  • Protect private instance data - Each instance of a class has its own unique private instance data table that cannot be accessed outside the scope of class functions unless the developer chooses to do so. MayronObjects automatically injects this table as the first parameter for all class methods when called from an instance object.
  • Define and enforce strict typing rules for class method parameters and return value types. MayronObjects will detect invalid arguments passed to method parameters or returned from a method and will raise helpful Lua errors for the developer to fix. Checking for unexpected behavior improves the development experience and results in fewer bugs published and discovered by your users.
  • Define private and static class methods. Private methods must be called from the private data table using a unique Call method. Developers must call static methods from the class table itself. Both private and static methods support strict typing rules.
  • Create interfaces to enforce strict method and property rules to be implemented by classes and instances.
  • Define default parameter values, including both primitive types (strings and numbers) and complex types (tables, functions, Blizzard widgets, and other classes and interfaces).
  • Create reusable generic classes - Instances of a generic Class can specify the types to be used for generic parameter types defined by the generic class. Generic Classes allow developers to reuse the same class logic for multiple purposes, such as creating a list data structure that only works with number values and another list using the same class to only support string values.
  • Define attributes and attach them to class methods to apply pre-execution logic. Attributes can manipulate argument values before being passed to class method parameters. Attributes can also prevent class method executions if custom attribute conditions fail.
  • Create, export, and import packages containing entities, such as classes, interfaces, and attributes, to be shared with other developers.

How Inheritance Works:

Each class can inherit from at most one parent class but can implement multiple interfaces. All classes either directly or indirectly inherit from the base Object class, which provides many useful functions that all instances of any class can access.

Collection Classes:

The framework also comes with standard collection classes (List, Stack, Map, LinkedList). You can remove these collection classes if you do not require them (make sure to also remove references to them insideMayronObjects.xml).

Demos:

There is a Test.lua file included in the MayronObjects folder to see other working examples of how to use this framework.

For the full maintained documentation, please visit:
documentation

For help and support, please visit the MayronUI discord server:
https://discord.gg/8Kh3maU


How to Support the Project:

1. Submitting feature requests, bug reports, or even contributing towards its development over on GitHub:

2. Getting involved by joining our active and growing Discord community:

3. Becoming a Patron to gain exclusive benefits:

4. Giving one-off donations through PayPal:

Thank you so much for your support!