-1
请帮忙。我正在尝试修复此代码,但我没有看到该错误。我很缺乏经验,并感谢您可以给我的任何帮助。谢谢。尝试索引本地'工具提示'(一个零值)
错误:UberInventory-6.8.lua:1325:试图指数当地的 '提示'(一个零值)
码 - 在行1320
function UberInventory_HookTooltip(tooltip)
-- From global to local
local UBI_Hooks = UBI_Hooks;
-- Store default script
local tooltipName = tooltip:GetName();
UBI_Hooks["OnTooltipSetItem"][tooltipName] = tooltip:GetScript("OnTooltipSetItem");
UBI_Hooks["OnTooltipCleared"][tooltipName] = tooltip:GetScript("OnTooltipCleared");
-- Set new script to handle OntooltipSetItem
tooltip:SetScript("OnTooltipSetItem", function(self, ...)
-- From global to local
local UBI_Hooks = UBI_Hooks;
-- Get tooltip name
local tooltipName = self:GetName();
-- Call default script
if (UBI_Hooks["OnTooltipSetItem"][tooltipName]) then
UBI_Hooks["OnTooltipSetItem"][tooltipName](self, ...);
end;
-- Call new script (adds the item information)
UberInventory_AddItemInfo(self);
-- Turn on UberInventory indicator
self.UBI_InfoAdded = true;
end);
-- Set new script to handle OnTooltipCleared
tooltip:SetScript("OnTooltipCleared", function(self, ...)
-- From global to local
local UBI_Hooks = UBI_Hooks;
-- Get tooltip name
local tooltipName = self:GetName();
-- Force reset of fonts (maxlines is a custom attribute added within the UberInventory_AddItemInfo function)
if (self.maxlines) then
local txtLeft, txtRight;
for i = 1, self.maxlines do
txtLeft = _G[self:GetName().."TextLeft"..i];
txtRight = _G[self:GetName().."TextRight"..i];
if (txtLeft) then txtLeft:SetFontObject(GameTooltipText); end;
if (txtRight) then txtRight:SetFontObject(GameTooltipText); end;
end;
end;
-- Call default script
if (UBI_Hooks["OnTooltipCleared"][tooltipName]) then
UBI_Hooks["OnTooltipCleared"][tooltipName](self, ...);
end;
-- Turn off UberInventory indicator
self.UBI_InfoAdded = false;
end);
end;
这里开始是从行代码2074至87年,其中 “HookTooltip” 被称为
function UberInventory_Install_Hooks()
-- Hook the Tooltips (OnTooltipSetItem, OnTooltipCleared)
UberInventory_HookTooltip(GameTooltip);
UberInventory_HookTooltip(ItemRefTooltip);
UberInventory_HookTooltip(ShoppingTooltip1);
UberInventory_HookTooltip(ShoppingTooltip2);
UberInventory_HookTooltip(ShoppingTooltip3);
-- Hook mail stuff
UBI_Hooks["ReturnInboxItem"] = ReturnInboxItem;
ReturnInboxItem = UberInventory_ReturnInboxItem;
UBI_Hooks["SendMail"] = SendMail;
SendMail = UberInventory_SendMail;
end;
我相信,以下是其中的代码调用它... – Chorthee 2014-10-18 00:00:53
功能UberInventory_Install_Hooks() - 胡克的工具提示(OnTooltipSetItem,OnTooltipCleared) UberInventory_HookTooltip(GameTooltip); UberInventory_HookTooltip(ItemRefTooltip); UberInventory_HookTooltip(ShoppingTooltip1); UberInventory_HookTooltip(ShoppingTooltip2); UberInventory_HookTooltip(ShoppingTooltip3); - 钩邮件 UBI_Hooks [“ReturnInboxItem”] = ReturnInboxItem; ReturnInboxItem = UberInventory_ReturnInboxItem; UBI_Hooks [“SendMail”] = SendMail; SendMail = UberInventory_SendMail; 结束; – Chorthee 2014-10-18 00:03:24
其中一个调用将'nil'作为其值。如果你想弄清楚哪一个,在函数调用的第一行添加如下内容:'if tooltip == nil then error('pass nil'..debug.traceback())end'。 – 2014-10-18 02:06:55