Thread Tools Display Modes
02-27-20, 07:12 AM   #1
Kinav
A Kobold Labourer
Join Date: Feb 2020
Posts: 1
String variables in C_LFGList.GetSearchResultInfo

Some addon doesn't work in my russian client. I tried to find problem and fix it. And found next problem with API and some string variables. API function C_LFGList.GetSearchResultInfo returns "name" and "comment" as string. But only print() LUA-command works fine with this string. There is an example of my code:

HelloWorld.toc
Code:
## Interface: 80300
## SavedVariables: name, comment
## Title: Hello World!
## Notes: My first AddOn
## Version: 1.0.0

HelloWorld.lua
HelloWorld.xml
HelloWorld.lua
Code:
local b = CreateFrame("Button", "MyButton", UIParent, "UIPanelButtonTemplate")
b:SetSize(80 ,22) -- width, height
b:SetText("Button!")
b:SetPoint("CENTER")
b:SetScript("OnClick", function()
	name = C_LFGList.GetSearchResultInfo(693).name
	comment = C_LFGList.GetSearchResultInfo(693).comment
	print("name: ", name,". String len: ", string.len(name))
	print("comment:", comment,". String len: ", string.len(comment))
end)
HelloWorld.xml
Code:
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd">
         <Script File="HelloWorld.lua"/>
         <Frame name="HelloWorldFrame">
                <Scripts>
                        <OnLoad>
                        </OnLoad>
                </Scripts>
         </Frame>
 </Ui>

Result in game:
Code:
name: the shard of heaven farm wm of. String len: 8
comment: осколки небес фарм вм оф. String len:8
and saved this variables in file "...World of Warcraft\_retail_\WTF\Account\...\SavedVariables\HelloWorld.lua"
Code:
name = "|Kr730|k"
comment = "|Kr731|k"

Possible problem with UTF8 charset, but UTF8 addon also doesn't work with these strings.

Update: the same problem is with EN game client.

Last edited by Kinav : 02-27-20 at 10:38 AM.
  Reply With Quote
02-27-20, 12:38 PM   #2
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
That is Blizzard's method of "encrypting" or obfuscating strings. The tech started with realID and battletags where add-ons are unable to actually access anyone's real name even though you can see it. If you're familiar with text formatting, the system uses | then a letter then data input then another | and usually the same letter lowercase. This is most commonly seen with colors using |chexcodeTEXT|r and clickable inline links using |Hlinkdata|hVisibleText|h. Communities, group finder, and bnet friends all use |Kdata|k for obfuscation.

It is not possible for code to read or save what you see.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » String variables in C_LFGList.GetSearchResultInfo

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off