OOP is really important to the creation of WoW addons, so I figured this needed to be created. Please note I included some C++ code. While some may think this is off-topic, it's actually a really good idea. This is because not all programmers are familiar with Lua, and correlation between languages helps others gain a better understanding of their purpose in general; not just how it works in Lua. Knowing the syntax of a language is pointless if you don't know how to employ it. --Shirik 18:57, 29 March 2007 (EDT)

hmm. i have a strong urge to get rid of the section on namespaces. the notion of a namespace is not at all related to OOP. its one tool in one language, and all it provides is a layer of scoping completely agnostic of objects. since namespaces also dont exist in lua, i really dont see any reason for this content in this article. Ukadrezel 14:18, 13 November 2007 (UTC)

all right, good write up. i cleaned it up to make it a little easier to understand. Ukadrezel 17:36, 13 November 2007 (UTC)

Reversion to Apr 5 Edit

I reverted a huge revision due to there just being too much to correct. The old (new) one is still there in the history for those whom wish to view it. While I liked a lot of the changes, there were quite a few problems with it that I just don't have the time to correct right now. (And this doesn't include me being a grammar Nazi and being annoyed by the extensive overuse of acronyms.)

I can understand dropping huge sections to rewrite a lot of it, but when you drop something like an entire section and then don't discuss it in the new version, well, I just don't see a reason for that. I can agree with dropping the C++ code but there isn't enough about namespaces and why they're used, for example. There also is no reminder that functions are variables, which can leave newer Lua programmers completely baffled about the various syntaxes available.

Concurrently, not ALL metatables have a __index entry, as was written. A metatable CAN, but then again, it can have whatever the hell it wants. The __index entry just gets a bit of special treatment. Most importantly, though, it is not a requirement for this to exist -- I have written tons that don't use one because that's not the purpose of the table. The biggest one that comes to mind is

    pool = setmetatable({}, {__mode = "kv"});

As a result I just dropped it. I'm a fan of rewriting a lot of things here as they could really be changed, but the change that was supplied was just unprofessional, incomplete, and wrong. Shirik 06:08, 4 December 2007 (UTC)

RE "there isn't enough about namespaces and why they're used":

As Ukadrezel points out, namespaces are NOT an 'object oriented concept'. A namespace is nothing more than a scoping mechanism. Conflating it with object orientation is going confuse readers who need this article most.

RE C++ examples:

The first rule of writing is to identify your audience. Who you are writing for? C++ programmers don't need this article. The new programmers who do (1) get nothing from the C++ (2) may be scared away by it. So the C++ examples are at best pointless, and at worst counterproductive.

RE the namespace example:

Nowhere in the article does it mention that in Lua a translation unit (file or string) is it's own scope. Simply making your addon's functions local keeps them out of the global namespace, with a side benefit of increasing performance.

RE: "functions are variables":

Functions are not variables, they are objects. Lua is a dynamic language: variables do not have type, only objects do.

--MalygosMud (talk) 05:11, 8 October 2008 (UTC)

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.