mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-10 20:07:37 +00:00
fix(link): split links with string.split captured at load
LinkUtil.SplitLinkData and SplitLinkOptions looked up string.split on every call. BigWigs (pepopo978 fork) defines a table-returning string:split in Plugins/SpellRequests.lua, which replaces the global, so with it loaded every custom link type resolved to a table, no handler matched, and SetItemRef rejected the link as unknown. string.split is registered in C by the DLL before any addon loads, so a file-local captured when LinkUtil.lua loads always holds the real one. Fixes brues-code/pfUI#73
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
local strsplit = string.split;
|
||||
|
||||
LinkTypes = {
|
||||
AADCOpenConfig = "aadcopenconfig",
|
||||
Action = "action",
|
||||
@@ -75,7 +77,7 @@ function LinkUtil.FormatLink(linkType, linkDisplayText, ...)
|
||||
end
|
||||
|
||||
function LinkUtil.SplitLinkData(linkData)
|
||||
local linkType, linkOptions = string.split(":", linkData, 2);
|
||||
local linkType, linkOptions = strsplit(":", linkData, 2);
|
||||
linkOptions = linkOptions or ""; -- Could be nil if there's no ":" in linkData.
|
||||
return linkType, linkOptions;
|
||||
end
|
||||
@@ -85,7 +87,7 @@ function LinkUtil.SplitLink(link) -- returns linkText and displayText
|
||||
end
|
||||
|
||||
function LinkUtil.SplitLinkOptions(linkOptions)
|
||||
return string.split(":", linkOptions);
|
||||
return strsplit(":", linkOptions);
|
||||
end
|
||||
|
||||
-- Extract the first link from the text given, ignoring leading and trailing characters.
|
||||
|
||||
Reference in New Issue
Block a user