R
(33Kb)
Download
Updated: 12-22-20 08:41 AM
C
(33kB)
Download
Updated: 12-22-20 08:41 AM
Pictures
File Info
Compatibility:
Classic Patch (1.13.6)
Updated:12-22-20 08:41 AM
Created:08-23-17 03:23 PM
Downloads:1,742
Favorites:1
MD5:
Categories:Libraries, Developer Utilities

MayronObjects

Version: 3.1.5, Classic: 3.1.5-classic
by: Mayron [More]

⚫ 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.
⚫ Full Documentation
For the full maintained documentation, please visit:
mayronui.com/p/mayron-objects
⚫ Help and Support
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!

3.1.4
  • Improved recycling using PushTable and PopTable*
  • Passing an explicit `nil` value to a function will now use a default value if one has been defined, even for trailing `nil` values
  • obj:IterateArgs now iterates trailing `nil` values.

3.1.3
  • Added support for default values for union type definitions.
  • Added support for `nil` values passed to any position when defining parameter and return types. It now defaults to `?any`.
  • You can now export packages without attaching the package to a parent package namespace by omitting the 2nd argument of the Export function.

3.1.2
  • Support for variable list definitions - you can now specify strict typing rules for varargs and multiple return values.
  • Added `ToLongString` framework utility method to convert a table to a string.
  • Added `spaces` parameter to `PrintTable`, similar to the `spaces` parameter used for `ToLongString`.

3.1.0
  • Removed LibStub and added a new version control method (see documentation on the website).
  • Added strict typing support for private and static methods.
  • Removed `Embed` from data table as there is now a better solution for this.
  • Added `Call` to data table to call private functions
  • Renamed from LibMayronObjects to MayronObjects
  • Fixed a few rare edge-case bugs.

3.0.3
  • Added data:Embed(tbl) to assign all values from the tbl to a private instance data table. This is useful for defining private instance functions outside class functions.
  • Made the List collections classic generic to support only strings, numbers, etc... per instance.
  • Added Lib:FillTable() helper method.
  • Added SetName and GetName to the object class to allow you to give them names - useful when testing.

3.0.2:
-- Updated docs and internal comments
-- Moved LibStub inside of xml
-- Lots of small improvements for better code standards.

3.0:
-- Added ability to add default parameters
-- Added new "attributes" feature
-- Fixed bug with UnpackTable method

2.8:
-- Added more helper Lib functions for memory performance
-- Restructured metatable functions and worked on memory optimization

2.7:
-- Fixed memory leak
-- Improved error handling

2.5:
-- Reduced more memory usage
-- Removed the "Implements" function: Implementing interface functions work the same way as implementing interface properties - If not implemented, after constructing an object from the class that implements the interface, an error will be thrown.

2.4.1:
-- Restructured code
-- Made defined properties strongly typed after constructor executes

2.4:
-- Added support for Defining Properties in Interfaces (must be implemented in constructors)
-- Added support for generic types
-- Updated toc for BFA expansion
-- Added more classes and added test lua file to see examples of how the library works

2.3:
-- Merged everything into 1 Lua file so that it is far easier to use

2.1:
-- Export function parameters changed
-- Export can only export 1 package at a time

2.0:
-- Added Package Class
-- Can only export packages!
-- Removed Import modifiers (*, +, -)
-- Added Object:Parent()
Optional Files (0)


Post A Reply Comment Options
Unread 12-17-20, 10:33 AM  
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view AddOns

Forum posts: 275
File comments: 1200
Uploads: 12
All documentation on the website has been updated to reflect the below changes:

3.1.4
  • Improved recycling using PushTable and PopTable*
  • Passing an explicit `nil` value to a function will now use a default value if one has been defined, even for trailing `nil` values
  • obj:IterateArgs now iterates trailing `nil` values.

3.1.3
  • Added support for default values for union type definitions.
  • Added support for `nil` values passed to any position when defining parameter and return types. It now defaults to `?any`.
  • You can now export packages without attaching the package to a parent package namespace by omitting the 2nd argument of the Export function.

3.1.2
  • Support for variable list definitions - you can now specify strict typing rules for varargs and multiple return values.
  • Added `ToLongString` framework utility method to convert a table to a string.
  • Added `spaces` parameter to `PrintTable`, similar to the `spaces` parameter used for `ToLongString`.

Please see section 4.3, Variable List Definitions, in the documentation for details on how to use this feature:
https://mayronui.com/p/mayron-object...t-typing-rules
__________________
MayronUI Discord communitymayronui.com
Last edited by Mayron : 12-19-20 at 08:59 AM.
Report comment to moderator  
Reply With Quote
Unread 12-05-20, 05:38 PM  
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view AddOns

Forum posts: 275
File comments: 1200
Uploads: 12
All of the documentation has been updated: Visit: https://mayronui.com/p/mayron-objects to read it!

Change Log 3.1.0
  • Removed LibStub and added a new version control method (see documentation on the website).
  • Added strict typing support for private and static methods.
  • Removed `Embed` from data table as there is now a better solution for this.
  • Added `Call` to data table to call private functions
  • Renamed from LibMayronObjects to MayronObjects
  • Fixed a few rare edge-case bugs.

This is a major update. Please read the documentation on the official website for instructions on how to use the new private functions and static function features.

Also, you now get the framework using:

Lua Code:
  1. local obj = MayronObjects:GetFramework();

Instead of using LibStub. There is a reason for the change but it's only to deal with edge cases I was finding when using it in MayronUI.
__________________
MayronUI Discord communitymayronui.com
Last edited by Mayron : 12-06-20 at 05:31 AM.
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump:

Support AddOn Development!

You have just downloaded by the author . If you like this AddOn why not consider supporting the author? This author has set up a donation account. Donations ensure that authors can continue to develop useful tools for everyone.