• 0

    posted a message on Documenter status

    Seems I misinterpreted his post then, sorry.

     

    If luadoc just wasn't such a pain... :-/

    Posted in: General Chat
  • 0

    posted a message on Documenter status

    Hmm, I'd hoped that you could patch it up again, the old thread indicated that Stanzilla was working on it?

     

    Posted in: General Chat
  • 0

    posted a message on Etiquette for taking ownership of an abandoned addon?

    PM the previous author. It's just being nice.

     

    Abandoned projects are marked as abandoned by the system automatically after a few months or patches (don't know the logic behind it), it will then show an option for you to take over.

     

    There is also an issue with projects that are "All rights reserved", they technically can not be taken over, because Curse/Wowace does not have the rights to do so, unless I missed something in the EULA.

    Posted in: General Chat
  • 0

    posted a message on Documenter status

    Referencing this thread from the old forums: Documenter broken?

    The pending commits list contains > 300 entries

    The top changed repository in the pending commits list (I assume its a FIFO list?) is Skada which had the last repository change from August 31 -- and the list does not change.

    The "Status" says it's running, but that does not seem to be the case - Is the documenter taking a summer break? :)

     

    PS: (forum feedback) the preview button is broken in the create-threads view, it redirects to an error page, links are orange in the editor, but dark-grey in the actual post, which makes them very hard to discern from normal text

    Posted in: General Chat
  • 0

    posted a message on date leakage...
    You could also do something like this:

    local tz, tzdiff;
    function time_utc()
       if tz ~= date("%z") then
           --print("Updating tzdiff");
           local utc, here = date("!*t"), date("*t");
           here.isdst = false;
           tzdiff = difftime(time(here), time(utc));
           tz = date("%z");
       end
       return time()-tzdiff
    end
    
    print(date("%c", time_utc()))
    I did a quick test that actually led me to change the isdst flag as this would otherwise generate wrong output (you should consider that in your code too, even if you don't use mine)

    After the first run you don't get any new tables, and if the timezone ever changes, it should get updated automatically
    Posted in: Lua Code Discussion
  • 0

    posted a message on Snapshotting player stats for DoTs
    Quote from jlam
    ...
    If what you are doing is an indicator of relative DoT strength, I want it!!! :)
    Posted in: Lua Code Discussion
  • 0

    posted a message on how do i detect mob death...
    Quote from tinystomper
    btw, it seems UnitReaction takes a UnitID.. and 'bossN' doesn't seem to work.

    i'm in stockades with Randolph Moloch swinging at me.. and UnitGUID("boss".. n ) returns nil for n (1..5). UnitReaction("boss".. n ) also returns nil. "npc" also returns nil. only 'target' seems to get any valid returns.

    thoughts?

    I think "NPC" is only used for things like "talking to anduin" so that the lore window (and other such ui panels like vendor, etc.) does not lose its target even if you target another unit.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Removing WoW escape sequences from a string
    Quote from saiket
    You're right that each match will generate new strings for the color code and pipes, but because identical strings are re-used in Lua's string pool, this technique doesn't generate nearly as much garbage. It works especially well when the number of unique color codes you might encounter is limited, such as with syntax highlighted tokens.
    Lua still has to generate them, create hashes, test the string table for existing hashes and call the callback function. String operations are known to be expensive operations in Lua (compared to other simple operations), not in memory but in CPU time. In comparison even four chained gsubs are more efficient.

    Also, you can do this easier, if you are going to use callback functions: You can "fake" branches and get a much simpler function like this

    print(str:gsub("|([|cr])(%x?%x?%x?%x?%x?%x?%x?%x?)",function(c, arg)
        if c == "r" then
            return arg;
        elseif c == "c" and #arg == 8 then
            return "";
        end
    end));
    I had already thought about such a solution while answering Iroared, but expected a lot worse performance -- Or rather for gsub to perform better. Pretty sure it handles all border cases although I have not tested it thoroughly since, as it is, it takes 15-30% longer to parse input than my current 4 gsubs (yeah, I've profiled it). It works because the "|" are consumed and you don't call gsub a 2nd time.

    Of course this also won't work with the more complex escape sequences unless you manage to come up with a monster pattern like Phanx' that covers everything and then test that again in the callback. (I would like to see that code though, should be fun, you'd have to go recursive for link text -- I think.)

    If there was a simple replacement function without patterns in Lua though, there would be no challenge ;)
    Posted in: Lua Code Discussion
  • 0

    posted a message on how do i detect mob death...
    Quote from tinystomper
    ugh.. that's what i was afraid of. seems like i'd be constantly checking (i try to keep that to a minimum)

    another odd thing, on one test in scarlett halls (mop) armsmaster harlan came up as a vehicle and not an npc

    http://i.imgur.com/tNEfSgn.png

    i'm pretty sure i'm parsing the guid correctly. seemed very odd.

    Isn't he the one with that whirlwind attack? Most likely when he's whirling he's in a vehicle
    Posted in: Lua Code Discussion
  • 0

    posted a message on Removing WoW escape sequences from a string
    Quote from saiket
    Yep, forgot to mention that.

    You mean those that are called for every match and thus also generate a string for each pattern *hint*hint* ;)
    Posted in: Lua Code Discussion
  • 0

    posted a message on Removing WoW escape sequences from a string
    Quote from saiket
    Rather than replacing all escaped pipes with "|!", you could rewrite your patterns to match "(|*)|r" and then count the string length of the pipes sub-match. If the length is even (#pipes % 2 == 0), then the control code is active and should be replaced by just the pipes sub-match. This technique avoids making a complete copy of your edit box's contents escaped with exclamation points.
    You mean in a gsub replacement-callback function?
    Posted in: Lua Code Discussion
  • 0

    posted a message on Removing WoW escape sequences from a string
    Quote from Iroared
    Ideally, strings should be parsed sequentially (as they probably are in the client) to avoid all corner cases, but the code for that would be longer.

    Lookbehinds won't really help, either, because "|||r" should become "||". Replacing "||" with "|!" seems like it should work, if you want to stick with patterns.
    Yes I figured that out too afterwards, I was a bit fixed thinking in Lua patterns.

    I'm pretty sure branches would suffice for the simple escape sequences without recursion (||, |cAARRGGBB, |r, ...?). But since Lua patterns don't have branches, this actually wouldn't help either :D
    Posted in: Lua Code Discussion
  • 0

    posted a message on Break my tokenizer!
    While implementing syntax highlighting for my little project Grease goblin, I wrote/am writing a Tokenizer for the Lua language. Now I'm at a point where I ran out of test cases, so I'm looking for help finding parsing errors.

    I'm looking for bugs/input that causes the tokenizer to break as well as incorrect, missing or surplus tokens, as the tokenizer must return character-perfect tokens for highlighting.

    If you want to help out finding bugs, you can grab the source at http://hg.curseforge.net/wow/lua-tokenizer/mainline and play with it. There are also zips from the packager.

    The test subdirectory contains a few tools for easier testing. Most notably, if you make the whole directory accessible by a PHP-enabled web server, index.html will continuously poll Test.php via AJAX, which makes it easy to play around with the syntax. The test script also runs the input file through Lua's loadstring (without actually running the code) and prints any errors after the output.

    While performance could certainly be better (It is only partly optimized), I'm quite satisfied with it - on my system the tokenizer parses it's own code in under 8ms. Its weak points are single-character "pass-through" tokens. Those could probably be optimized.

    Thanks in advance to any testers ;)
    Posted in: Lua Code Discussion
  • 0

    posted a message on SetAttribute in combat probably?
    Quote from b0s
    local bor,band = bit.bor, bit.band -- get a local reference to some bitlib functions for faster lookups
    Ahh that's why they write? To functions to work faster? And what a performance gain here?
    The topic of why this is faster can be quite a long one, suffice to say that

    local band = bit.band
    band(foo)
    can be more than 50 times faster for any successive calls of band(x) than just

    bit.band(foo)
    While in relation this sounds a lot, often you don't have to care as we are talking about nanoseconds here, but the event COMBAT_LOG_EVENT_UNFILTERED is called VERY often in combat (essentially it is what gets written into the /combatlog file) and so every nanosecond counts
    Posted in: Lua Code Discussion
  • 0

    posted a message on Removing WoW escape sequences from a string
    Quote from Phanx
    Sorry if my desire to find the most optimal solution -- in this case, the one with the fewest function calls and string creations -- is so offensive to you.
    It is not offensive, I just don't see the sense in it seeing as your solution does not return the expected output for a given input.
    Posted in: Lua Code Discussion
  • To post a comment, please or register a new account.