View Single Post
09-07-14, 10:30 AM   #2
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
I'm not going to fine-tooth comb the code, but this chunk at line 180 doesn't look like it should work correctly.
Code:
local function updateHeight(self)
    local self = getChicchai(self)
    if(self.State ~= DOWN) then return end
    self.Frame:ScrollToBottom()
    self.Frame:SetHeight(getMinHeight(self.Frame))
end
Let me get this straight:
  1. Pass self (presumably the AddOn reference?) to the function updateHeight
  2. Immediately overwrite self with an entirely new value (why??)
  3. If the new value is anything other than DOWN, exit out
No wonder self is throwing nil errors. Based on a cursory look at the code, how in the world are you, as a follow-up author, supposed to keep track of what self is referring?

If I understand that chunk correctly, using different names that are descriptive, it goes like this:

Hey function, here is Bob. Now use a Star Trek transporter to make a copy of Bob, and assign Bob's copy the DNA of Bob's uncle Tony, but still call the copy Bob. Bob is still here, and we have a copy of Bob that looks like Tony. Bob isn't doing anything, so he sits down and reads a book.

Tony looks around confused, thinking he is in the wrong home, and has no clue why. Meanwhile BobTony is feeling emotional, but only sticks around if he is feeling down. If he is feeling up, he bolts and goes plays some Diablo III. Smart guy, BobTony!

On track, add some debug prints before and after line 181. Both should print out the value of self. See what you get.

Last edited by myrroddin : 09-07-14 at 10:43 AM. Reason: Silly narrative?
  Reply With Quote