-
Posted by Omnius on Wed, 19 May 2010 21:09:56
I was looking at an addon and got a little confused by how LibStub was used - the addon was using a library called ScrollingTable (or externally, lib-st), and I saw in that library the call to LibStub:NewLibrary(), etc, but the main addon seems to be making a call that looks like:
local ScrollingTable = LibStub("ScrollingTable")
What does using the library name like a function call do? I've looked at the book and the WoWwiki page and can't seem to find a mention of that syntax. I'm sure it's hiding right in front of me 8^).
-
Posted by jnwhiteh on Wed, 19 May 2010 21:14:28
It's a bit of magic, but LibStub("Foo") is the same as LibStub:GetLibrary("Foo"). This is accomplished via the __call metamethod in the LibStub table. You can read more about that metamethod in the book (the index should show the pages for it).
-
Posted by Omnius on Wed, 19 May 2010 21:29:08
That was fast 8^). Thanks, figured it was probably in there somewhere.