• 0

    posted a message on Addon Template
    Quote from "Adirelle" »
    That's part of the Lua language. See the loadfile built-in function.


    Okay, so load, loadstring and loadfile parse/compile the stuff they get into an anonymous function which can then be run. So, then, the anonymous function returned from load* is defined with "..." as its parameter, and that's what allows them to pass the name and the table in. I confirmed that to be the case with this test:
    /run loadstring("print(...)")("dog")

    So, it sounds like the client does this: load and parse/compile the code in the addon file and call the resulting anonymous function, passing in the name of the addon and the table that is being passed to all of the files for the addon.

    Sound right?

    Quote from "Adirelle" »
    The game client passes the addon name, i.e. the name of the containing folder, and the same table to every lua files in the folder.

    Now that I know what I know about the load* functions, it looks like Lua made the choice to create the anonymous function with the vararg parameter to provide the ability to do just what the game client is doing. I am happy that I correctly guessed the mechanics of how that works :).

    Quote from "Adirelle" »
    You cannot put "local" before this statement. The semi-colon function notation is a syntactic sugar [...]

    Gah! I knew that, I swear I did.

    Quote from "Adirelle" »
    Assign "f" to a global name, e.g. remove "local" or assign it to a global


    What I meant is, if you do not use something like LibStub and do not make a global for it, is there any way for external code to get a reference to the "addon table" (be it whatever the addon has created it as)? It looks like the answer would be no, but I could imagine WoW having some kind of sneaky way of keeping track of addons that might be accessible to us.

    Is there an API for querying the subscriber list for an event? I guess even if you could get that, it would just be a function reference and still not the "addon table".

    EDIT: I was looking for something else on wowprogramming.com and noticed the RunScript function. I guessed it was just something like this, inside:
    function RunScript(script)
        loadstring(script)()
    end

    However, when I went to see over at Tekkub's UI code repository, I couldn't find a reference to it or a definition for it in those code files. Where does it come from?

    Which leads me to another question: Wowpedia says "Only a subset of version 5.1 of the official Lua specification is implemented [...]". So, Blizzard has customized the WoW Lua interpreter. They'd have to, I suppose, to be able to properly enforce the sandbox. So, if that's the case, what else did they change? Did they just remove API functions and add others or did they actually make alterations to the mechanics of the interpreter and/or the language?

    And, back to RunScript ... I guess if it's not in the FrameXML code, then it has to be a custom C-side function? If it is, then why do they need it when loadstring is still available? What does it do differently? It has to be different or they'd just have implemented it on the Lua side, I'd think. 5.1's version of load didn't have all those new parameters from 5.2 (source, mode and env); it appears that all load*ed stuff just gets the global environment in 5.1. Given that, they can't be really doing anything to affect how loadstring does the loading ... unless they've added other stuff that lets them modify how load works... Gah.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Addon Template
    Since you posted that, I'll take this opportunity to ask a couple questions I've had for a little while. In this...

    local ADDON, private = ...


    ...what is "passed in" to code files for addons? If I wanted to discover the answer to that myself, where would I need to think to look?

    Also, what is the mechanism by which the WoW UI "loads" the addon files such that it even has the ability to "pass stuff" into a file? Does it do something like wrap the contents in a function or does Lua just support this?

    if IsLoggedIn() then
            self:PLAYER_LOGIN()


    When would ADDON_LOADED fire and find the player to already be logged in? Is this just computer-speed dependent? What are the benefits to doing this two-step loading process over just subscribing to PLAYER_LOGIN?

    function f:ADDON_LOADED(addon)


    If a function is being defined on the "addon table", what effect would putting "local" before its declaration have?

    If an addon is set up like this (without LibStub or something like it -- not registered in some shared repository), is it possible to get a handle on it (presumably I mean the "addon table", whatever it is -- I think) from outside of this addon's code (another addon, in a macro, etc.)?

    %%[dfqsx%d]


    From a brief scan of this, that appears to be "percent followed by d, f, q, s, x or ..." ... or what? Another percent then 'd'? %%d? If so, what is that?

    Thanks.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Removing Talents via Addon
    That's funny, we just had this discussion over here:

    http://www.wowhead.com/forums&topic=206666

    Are any of you any of those people?
    Posted in: Lua Code Discussion
  • 0

    posted a message on X-Perl Thread
    Quote from DavidTheMachine
    • The rest of the open tickets on Curseforge. Some are non-problems, some are unreproducible glitches.


    I guess you mean the tickets here? http://www.wowace.com/addons/xperl/

    I don't even see a CurseForge project for X-Perl.

    Anyhow, the thing I wanted to point out is this one:

    http://www.wowace.com/addons/xperl/tickets/1092-druid-shape-shift-health-bar-stuck/

    This definitely still happens. I've just turned off the mana bar so I don't have to deal with it.
    Posted in: Unit Frames
  • 0

    posted a message on BigWigs
    Quote from Jendany
    Ah they must have fixed broker2fubar then since until today the menu did not work only the icon was displayed and right clicking on it just brought up fubar options.


    They did change B2F to pass the right click through.
    Posted in: Raid AddOns
  • 0

    posted a message on Warning: New Trojan on wowui
    Why would anyone ever launch an executable file from within an archive they expect to contain a WoW addon?
    Posted in: Updaters
  • 0

    posted a message on CowTip 2.0
    Does anyone know exactly what happened to cause that OOR thing?
    Posted in: General AddOns
  • 0

    posted a message on X-Perl Thread
    Quote from Spennig
    I've gotten that too, but it only seems to be on one character, not all of them.


    Yeah, that too. That's why I figured it was just bad interaction or cruft. I also have absolutely no idea how to find out why some frame was moved. I guess you'd have to bind to some event and spit out some debug info. I try to only code at work :\.
    Posted in: Unit Frames
  • 0

    posted a message on CowTip 2.0
    Quote from Kerecha
    Notised the same
    For instance im used to mousing over partymembers to check where they are if they are not in range, and if there not in my zone (dunno exactly how close they need to be) i simply don't get any tooltip at all.


    I am having a similar problem. I was blaming it on X-Perl, but I guess not...
    Posted in: General AddOns
  • 0

    posted a message on X-Perl Thread
    Love this mod, and I want to keep on using it. The problem I have been having since the 3.0.2 patch is that my player frame keeps moving downward every time I reload, or log.


    I thought this was just something I screwed up or bad/old cruft in SV files. I guess it still could be; but, this happens to me too.
    Posted in: Unit Frames
  • 0

    posted a message on The New Curse Client
    Hmm, also, is the CC actually doing an individual call to the Curse servers for each addon? Is that why it takes so long to go through the list? Wouldn't it be better for Curse and faster for the CC to do one big query with the whole list of addons?
    Posted in: Updaters
  • 0

    posted a message on latest CC: updates same 8 mods over and over and over
    My attempts at manually installing stuff ended in fire and pain on P-Day. I finally bit the bullet and decided that on P-Day + 1, I would try again, but this time try to do it all through the Curse Client.

    I downloaded the newest version of the client. I turned off auto-update. I went into my Docs and Settings and cleared out all the cached CC stuff from previous installs and wiped my Addons folder clean. I tried to find everything through the search in the client. I only downloaded stuff manually when it wasn't listed.

    EDIT: Also, I set it to download Beta-level packages, just in case.

    Amazingly, it went very well. Most of the stuff I wanted, I was able to find through the search. Every addon I found and selected for download was in fact the newest, working and correct version of what I was intending to find.

    I went through on my Paladin alt's list of enabled addons yesterday. Today I'm going to try to tackle my Druid who has a good bit more. I hope today is as smooth as yesterday was.

    As an aside, I think people totally misunderstood what "auto-update" means for the new client. It's certainly not click-once-update like the WAU used to have. As it is, it's not really anything I would want to happen since I want to actually press a button to update stuff, generally. I have no problem clicking to update stuff individually. Maybe I'll get a premium account just to support the work that everyone has done on this process, but I'll probably leave auto turned off.

    I know nobody knows who I am -- I've lurked and read posts here for quite a while. I don't write addons but I do code for a living. I appreciate the value of this community quite a bit. Hopefully you'll take the opinions and experience of someone with one post as valid :).
    Posted in: Updaters
  • To post a comment, please or register a new account.