Go Back   WowAce Forums > Addon Chat > Frameworks > Ace2
Ace2 Ace2 framework discussion

Reply
 
Thread Tools
Old 07-16-2010   #1
LaoTseu
Senior Member
 
Join Date: Jun 2006
Posts: 491
Default Replacing AceOO with metatables

Someone mentioned to use two metatables to replace the AceOO stuff. Is there an article or example that we can point to to explain how to do this? I'm thinking of ppl that do normally do lua OO but would like to undertake the conversion of an addon that is no longer maintain.
LaoTseu is offline   Reply With Quote
Old 07-16-2010   #2
Adirelle
Legendary Member
 
Adirelle's Avatar
 
Join Date: Dec 2006
Posts: 2,386
Default Re: Ace2 End-Of-Life Discussion

Quote:
Originally Posted by LaoTseu View Post
Someone mentioned to use two metatables to replace the AceOO stuff. Is there an article or example that we can point to to explain how to do this? I'm thinking of ppl that do normally do lua OO but would like to undertake the conversion of an addon that is no longer maintain.
To prevent the thread to go further off-topic, you should ask this in a brand new thread.
__________________
Author of AdiButtonAuras, AdiBags, Squire2 and several other addons.

Each time you hit your "copy" command with a block of code, think about a way to refactor it so it did what you want without using the "paste" command.
Adirelle is offline   Reply With Quote
Old 07-16-2010   #3
Nevcairiel
Super Moderator
 
Nevcairiel's Avatar
 
Join Date: Aug 2005
Location: Germany/Hamburg
Posts: 1,811
Default Re: Replacing AceOO with metatables

I moved your posts to a new thread.

On the topic:
I don't 100% remember how AceOO worked, never liked it, never extensively used it.
But the basic OO principles are really easy to "fake" in Lua.

I'll look for an article when i get home, maybe i can find a good one again. I'm sure others will have them around as well, or will just explain here.
__________________
Author/Maintainer of Ace3, Bartender4, Mapster, Quartz, HotCandy, and various small and helpful addons.
You can Donate if you want, any help is appreciated!

Last edited by Nevcairiel; 07-16-2010 at 11:45 AM.
Nevcairiel is offline   Reply With Quote
Old 07-16-2010   #4
Adirelle
Legendary Member
 
Adirelle's Avatar
 
Join Date: Dec 2006
Posts: 2,386
Default Re: Replacing AceOO with metatables

A part of AceOO were used in AceAddon-2.0 and AceModule-2.0 (or whatever allowed to create modules). This part is taken care of by AceAddon-3.0.

If the addon called AceOO directly, there might be more things to do.

Here a basic OOP stub:

http://paste.wowace.com/2201/

The idea is to use the "__index" operation of lua metable that is used to look up for missing keys in other tables (or to be handled by a function, but we are not interested in that feature).
__________________
Author of AdiButtonAuras, AdiBags, Squire2 and several other addons.

Each time you hit your "copy" command with a block of code, think about a way to refactor it so it did what you want without using the "paste" command.
Adirelle is offline   Reply With Quote
Old 07-16-2010   #5
Farmbuyer
Amazing Member
 
Farmbuyer's Avatar
 
Join Date: Feb 2005
Posts: 1,110
Default Re: Replacing AceOO with metatables

For an introduction that is not specific to WoW (but applies in all cases to WoW addons), here are links into a book written by one of the Lua architects:

http://www.lua.org/pil/13.4.html (metatable usage)
http://www.lua.org/pil/16.html (OO stuff)
Farmbuyer is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:49 PM.