View Single Post
03-17-12, 02:22 AM   #10
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Mikord View Post
The simplest answer is that ipairs ... is an ... function.
Fixed. Calling functions is basically the slowest thing you can do in Lua, so you should do it as little as possible. In the same vein, if you ever find yourself writing something like this:

Code:
local function DoAnotherThing()
    -- do another thing here
end

local function DoAThing()
    -- do a thing here
    if something then
        DoAnotherThing()
    end
end

DoAThing()
... ask yourself if the code inside the DoAnotherThing() function will ever actually be called from anywhere else. If the answer is "no", then you should just move that code into the DoAThing() function.
  Reply With Quote