Originally Posted by Garkin
If I use d(zo_strformat("text <<t:1>>", itemLink)), it will print "textitemlink" - all spaces in front of the itemlink are removed. Is there any way how to get it working correctly?
|
If itemLink does not contain text all spaces between text and link will be removed. However if link contain text, it works correctly.
My solution (my workaround
):
Lua Code:
local function GetBetterItemLink(bagId, slotId, linkStyle)
local link = GetItemLink(bagId, slotId, linkStyle)
if link == "" then return end
local name = GetItemName(bagId, slotId)
local data = link:match("|H.-:(.-)|h")
if linkStyle == LINK_STYLE_BRACKETS then
return ("|H%s:%s|h[%s]|h"):format(LINK_STYLE_BRACKETS, data, name)
else
return ("|H%s:%s|h%s|h"):format(LINK_STYLE_DEFAULT, data, name)
end
end
local itemLink = GetBetterItemLink(bagId, slotId)
d(zo_strformat("text <<t:1>>", itemLink))