View Single Post
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