fixed to work with Lua 5.0

This commit is contained in:
Pinya
2017-12-14 20:38:18 +03:00
parent 5af41431d2
commit dca432abfd
8 changed files with 70 additions and 777 deletions
+14 -11
View File
@@ -1,3 +1,6 @@
local mod = math.mod
local getn = table.getn
EVENT_TRACE_EVENT_HEIGHT = 16;
EVENT_TRACE_MAX_ENTRIES = 1000;
@@ -18,7 +21,7 @@ local _framesSinceLast = 0;
local _timeSinceLast = 0;
local _timer = CreateFrame("FRAME");
_timer:SetScript("OnUpdate", function (self, elapsed) _framesSinceLast = _framesSinceLast + 1; _timeSinceLast = _timeSinceLast + elapsed; end);
_timer:SetScript("OnUpdate", function () _framesSinceLast = _framesSinceLast + 1; _timeSinceLast = _timeSinceLast + arg1; end);
function EventTraceFrame_OnLoad(self)
local frameName = self:GetName()
@@ -42,11 +45,11 @@ function EventTraceFrame_OnLoad(self)
self.lastIndex = 0;
self.visibleButtons = 0;
_EventTraceFrame = self;
self:SetScript("OnSizeChanged", EventTraceFrame_OnSizeChanged);
self:SetScript("OnSizeChanged", function() EventTraceFrame_OnSizeChanged(this, this:GetWidth(), this:GetHeight()) end);
EventTraceFrame_OnSizeChanged(self, self:GetWidth(), self:GetHeight());
self:EnableMouse(true);
self:EnableMouseWheel(true);
self:SetScript("OnMouseWheel", EventTraceFrame_OnMouseWheel);
self:SetScript("OnMouseWheel", function() EventTraceFrame_OnMouseWheel(tris, arg1) end);
end
local _workTable = {};
@@ -97,18 +100,18 @@ function EventTraceFrame_OnEvent (self, event, ...)
local hours = math.floor(minutes / 60);
seconds = seconds - 60 * minutes;
minutes = minutes - 60 * hours;
hours = hours % 1000;
hours = mod(hours, 1000)
self.times[nextIndex] = string.format("%.2d:%.2d:%06.3f", hours, minutes, seconds);
self.timeSinceLast[nextIndex] = 0;
self.framesSinceLast[nextIndex] = 0;
self.eventids[nextIndex] = GetCurrentEventID();
local numArgs = select("#", ...);
local numArgs = select("#", arg);
for i=1, numArgs do
if (not self.args[i]) then
self.args[i] = {};
end
self.args[i][nextIndex] = select(i, ...);
self.args[i][nextIndex] = select(i, arg);
end
if (self.eventsToCapture) then
@@ -138,7 +141,7 @@ end
function EventTraceFrame_OnSizeChanged (self, width, height)
local numButtonsToDisplay = math.floor((height - 36)/EVENT_TRACE_EVENT_HEIGHT);
local numButtonsCreated = #self.buttons;
local numButtonsCreated = getn(self.buttons);
if (numButtonsCreated < numButtonsToDisplay) then
for i = numButtonsCreated + 1, numButtonsToDisplay do
@@ -542,7 +545,7 @@ function ScriptErrorsFrame_OnError (message, keepHidden)
_ScriptErrorsFrame.times[index] = date();
else
tinsert(_ScriptErrorsFrame.order, stack);
index = #_ScriptErrorsFrame.order;
index = getn(_ScriptErrorsFrame.order);
_ScriptErrorsFrame.count[index] = 1;
_ScriptErrorsFrame.messages[index] = message;
_ScriptErrorsFrame.times[index] = date();
@@ -562,7 +565,7 @@ function ScriptErrorsFrame_Update ()
local editBox = ScriptErrorsFrameScrollFrameText;
local index = _ScriptErrorsFrame.index;
if (not index or not _ScriptErrorsFrame.order[index]) then
index = #_ScriptErrorsFrame.order;
index = getn(_ScriptErrorsFrame.order);
_ScriptErrorsFrame.index = index;
end
@@ -586,7 +589,7 @@ function ScriptErrorsFrame_Update ()
if (prevText ~= text) then
editBox:SetText(text);
editBox:HighlightText(0);
editBox:SetCursorPosition(0);
-- editBox:SetCursorPosition(0);
else
ScrollingEdit_OnTextChanged(editBox, parent);
end
@@ -597,7 +600,7 @@ end
function ScriptErrorsFrame_UpdateButtons ()
local index = _ScriptErrorsFrame.index;
local numErrors = #_ScriptErrorsFrame.order;
local numErrors = getn(_ScriptErrorsFrame.order);
if (index == 0) then
_ScriptErrorsFrame.next:Disable();
_ScriptErrorsFrame.previous:Disable();
+35 -35
View File
@@ -41,10 +41,10 @@
</Anchors>
<Scripts>
<OnClick>
EventTraceFrameEventHideButton_OnClick(self);
EventTraceFrameEventHideButton_OnClick(this);
</OnClick>
<OnLeave>
EventTraceFrameEvent_OnLeave(self:GetParent());
EventTraceFrameEvent_OnLeave(this:GetParent());
</OnLeave>
</Scripts>
<ButtonText text="X" inherits="GameFontRedSmall">
@@ -56,20 +56,20 @@
</Frames>
<Scripts>
<OnLoad>
local frameName = self:GetName();
self.time = _G[frameName.."Time"];
self.event = _G[frameName.."Event"];
self.HideButton = _G[frameName.."HideButton"];
self:GetHighlightTexture():SetAlpha(.15);
local frameName = this:GetName();
this.time = _G[frameName.."Time"];
this.event = _G[frameName.."Event"];
this.HideButton = _G[frameName.."HideButton"];
this:GetHighlightTexture():SetAlpha(.15);
</OnLoad>
<OnEnter>
EventTraceFrameEvent_OnEnter(self);
EventTraceFrameEvent_OnEnter(this);
</OnEnter>
<OnLeave>
EventTraceFrameEvent_OnLeave(self);
EventTraceFrameEvent_OnLeave(this);
</OnLeave>
<OnClick>
EventTraceFrameEvent_OnClick(self);
EventTraceFrameEvent_OnClick(this);
</OnClick>
</Scripts>
<HighlightTexture setAllPoints="true" alphaMode="ADD">
@@ -323,7 +323,7 @@
</Frames>
<Scripts>
<OnLoad>
self:RegisterForDrag("LeftButton");
this:RegisterForDrag("LeftButton");
</OnLoad>
<OnDragStart>
local eventTraceFrame = _G["EventTraceFrame"];
@@ -356,9 +356,9 @@
</Layers>
<Scripts>
<OnLoad>
self:SetFrameLevel(self:GetFrameLevel() + 1);
self:SetValue(0);
self:SetValueStep(1);
this:SetFrameLevel(self:GetFrameLevel() + 1);
this:SetValue(0);
this:SetValueStep(1);
</OnLoad>
</Scripts>
<ThumbTexture name="$parentThumb" file="Interface\Buttons\UI-ScrollBar-Knob">
@@ -369,19 +369,19 @@
</Frames>
<Scripts>
<OnLoad>
EventTraceFrame_OnLoad(self);
EventTraceFrame_OnLoad(this);
</OnLoad>
<OnShow>
EventTraceFrame_OnShow(self);
EventTraceFrame_OnShow(this);
</OnShow>
<OnEvent>
EventTraceFrame_OnEvent(self, event, ...);
EventTraceFrame_OnEvent(this, event, arg);
</OnEvent>
<OnUpdate>
EventTraceFrame_OnUpdate(self, elapsed);
EventTraceFrame_OnUpdate(this, arg1);
</OnUpdate>
<OnKeyUp>
EventTraceFrame_OnKeyUp(self, key);
EventTraceFrame_OnKeyUp(this, arg1);
</OnKeyUp>
</Scripts>
</Frame>
@@ -411,7 +411,7 @@
</Anchors>
<Scripts>
<OnLoad>
self:RegisterForDrag("LeftButton");
this:RegisterForDrag("LeftButton");
</OnLoad>
<OnDragStart>
local frame = _G["ScriptErrorsFrame"];
@@ -437,16 +437,16 @@
<Size x="343" y="194"/>
<Scripts>
<OnCursorChanged>
ScrollingEdit_OnCursorChanged(self);
ScrollingEdit_OnCursorChanged(this);
</OnCursorChanged>
<OnUpdate>
ScrollingEdit_OnUpdate(self, elapsed, self:GetParent());
ScrollingEdit_OnUpdate(this, arg1, this:GetParent());
</OnUpdate>
<OnEditFocusGained>
self:HighlightText(0);
this:HighlightText(0);
</OnEditFocusGained>
<OnEscapePressed>
self:ClearFocus();
this:ClearFocus();
</OnEscapePressed>
</Scripts>
<FontString inherits="GameFontHighlightSmall"/>
@@ -481,7 +481,7 @@
<Scripts>
<OnClick>
ScriptErrorsFrameButton_OnClick(self);
ScriptErrorsFrameButton_OnClick(this);
</OnClick>
</Scripts>
</Button>
@@ -500,7 +500,7 @@
<Scripts>
<OnClick>
ScriptErrorsFrameButton_OnClick(self);
ScriptErrorsFrameButton_OnClick(this);
</OnClick>
</Scripts>
</Button>
@@ -513,17 +513,17 @@
</Anchors>
<Scripts>
<OnClick>
HideUIPanel(self:GetParent());
HideUIPanel(this:GetParent());
</OnClick>
</Scripts>
</Button>
</Frames>
<Scripts>
<OnLoad>
ScriptErrorsFrame_OnLoad(self);
ScriptErrorsFrame_OnLoad(this);
</OnLoad>
<OnShow>
ScriptErrorsFrame_OnShow(self);
ScriptErrorsFrame_OnShow(this);
</OnShow>
</Scripts>
</Frame>
@@ -531,19 +531,19 @@
<GameTooltip name="FrameStackTooltip" frameStrata="TOOLTIP" hidden="true" inherits="GameTooltipTemplate">
<Scripts>
<OnLoad>
FrameStackTooltip_OnLoad(self);
FrameStackTooltip_OnLoad(this);
</OnLoad>
<OnShow>
FrameStackTooltip_OnShow(self);
FrameStackTooltip_OnShow(this);
</OnShow>
<OnEnter>
FrameStackTooltip_OnEnter(self);
FrameStackTooltip_OnEnter(this);
</OnEnter>
<OnUpdate>
FrameStackTooltip_OnUpdate(self, elapsed);
FrameStackTooltip_OnUpdate(this, arg1);
</OnUpdate>
<OnEvent>
FrameStackTooltip_OnEvent(self, event, ...);
FrameStackTooltip_OnEvent(this, arg);
</OnEvent>
</Scripts>
</GameTooltip>
@@ -551,7 +551,7 @@
<GameTooltip name="EventTraceTooltip" frameStrata="TOOLTIP" hidden="true" parent="EventTraceFrame" inherits="GameTooltipTemplate">
<Scripts>
<OnLoad>
DebugTooltip_OnLoad(self)
DebugTooltip_OnLoad(this)
</OnLoad>
</Scripts>
</GameTooltip>
+10 -10
View File
@@ -1,10 +1,10 @@
--Cache global variables
local format, match = string.format, string.match
local tinsert, tsort, twipe = table.insert, table.sort, table.wipe
local fmod = math.fmod
-- Cache global variables
local mod = math.mod
local pairs = pairs
local tostring = tostring
--WoW API
local format, match = string.format, string.match
local getn, tinsert, tsort, twipe = table.getn, table.insert, table.sort, table.wipe
-- WoW API
local GetTime = GetTime
DEBUG_FRAMESTACK = "Frame Stack"
@@ -21,7 +21,7 @@ local eventHandler = CreateFrame("Frame", "EventHandler", UIParent)
eventHandler:SetScript("OnEvent", EventHandler_OnEvent)
function GetCurrentEventID()
return #eventList
return getn(eventList)
end
function GetEventTime(eventID)
@@ -92,7 +92,7 @@ end
function UpdateFrameStack(tooltip, showHidden)
local x, y = GetCursorPosition()
for i = 1, #frameStackList do
for i = 1, getn(frameStackList) do
frameStackList[i] = nil
end
@@ -151,7 +151,7 @@ function UpdateFrameStack(tooltip, showHidden)
end
end
frameStackList[#frameStackList + 1] = nil
frameStackList[getn(frameStackList) + 1] = nil
tsort(frameStackList, FrameStackSort)
@@ -159,7 +159,7 @@ function UpdateFrameStack(tooltip, showHidden)
tooltip:AddDoubleLine(DEBUG_FRAMESTACK, format("(%.2f,%.2f)", x, y), 1, 1, 1, 1, .82, 0)
local cs, os, ol = 1, nil, nil
local cn = #colorSpecs
local cn = getn(colorSpecs)
local highlighted
local highlightFrame = GetMouseFocus()
@@ -173,7 +173,7 @@ function UpdateFrameStack(tooltip, showHidden)
end
if l ~= ol then
cs = fmod(cs, cn) + 1
cs = mod(cs, cn) + 1
ol = l
end