Skip to content

Issue with self. #183

@DakJaniels

Description

@DakJaniels

I've noticed that 'self' is sometimes not parsed correctly. Here is a section of code where 'self' is a parameter; it should trigger the colon in chatSystem.textEntry:AddCommandHistory(text), correct?

do
    local parts = {};
    local chatSystem = CHAT_SYSTEM;
    local originalAddCommandHistory = chatSystem.textEntry.AddCommandHistory;
    function chatSystem.textEntry:AddCommandHistory(text)
        -- Don't add the switch when chat is restored
        if db.addChannelAndTargetToHistory and pChatData.isAddonInitialized then
            local currentChannel = chatSystem.currentChannel;
            local currentTarget = chatSystem.currentTarget;
            local switch = chatSystem.switchLookup[currentChannel];
            if switch ~= nil then
                parts[1] = switch;
                if currentTarget then
                    parts[2] = currentTarget;
                    parts[3] = text;
                else
                    parts[2] = text;
                    parts[3] = nil;
                end;
                text = table.concat(parts, ' ');
            end;
        end;

        originalAddCommandHistory(self, text);
    end;
end;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions