1. Hi, I'm kind of new to this and working on some mods to existing addons.

    I'm primarily a C programmer and I have some questions about how to write the most efficient LUA code.

    So in C, we add a lot of parenthesis, mostly for clarity, but I don't see this in LUA.

    for example I would usually write

     if ( (a > b) or (b == x) or ( z >= 1) ) then 
       statement
     end
    

    Sure operator precedence will work, but parens show intent to programmers that may need to modify or maintain code later.

    Do extra parens slow things down in any way?

    Also, I see code making multiple passes through tables to get different values, rather than just collecting all the values needed on a single pass.

    I'm just trying to get a feel for how "fast" LUA and how clean addon code should be.

    Thanks, Andy

  2. Not sure if I caught you before you were finished, but I don't see a question anywhere =)

    P.S. Lua isn't an acronym, it's the Portuguese word for "moon", so no need to put it in all-caps.

  3. Sure operator precedence will work, but parens show intent to programmers that may need to modify or maintain code later.

    Do extra parens slow things down in any way?

    Absolutely not. Parenthesis (in any sane language) are just syntax, they disappear by the time the code is compiled or interpreted.

    Also, I see code making multiple passes through tables to get different values, rather than just collecting all the values needed on a single pass.

    It's hard to comment on this without a concrete example, but I'm not sure why you'd want to do that unless the logic required it.

    I'm just trying to get a feel for how "fast" LUA and how clean addon code should be.

    Lua is very fast and more often than not you don't need to worry about speed. There are a few minor exceptions, but unless you're doing something OnUpdate (which happens every frame refresh in WoW) then you should be alright!

  4. Thanks for the info!