Quantcast
In-game text editor tends to saves extra vertical slash ('|') into SV - WoWInterface
Thread Tools Display Modes
09-30-18, 04:52 PM   #1
Lyak
A Cyclonian
Join Date: Jul 2018
Posts: 46
In-game text editor tends to saves extra vertical slash ('|') into SV

Hi again all ,

So, I ain't sure where and why this is actually happening, but Input field tends to save extra vertical slash inside SV which is causing a hardship on saving things like escape sequences.

Lua Code:
  1. local testOption = {
  2.     type = "group",
  3.     childGroups = "tab",
  4.     name = "TestOption",
  5.     arg = "TestOption",
  6.     args = {
  7.         test = {
  8.             type = "input",
  9.             name = "Input",
  10.             width = "full",
  11.             get = function(info)
  12.                 return myDB.test;
  13.             end,
  14.             set = function(info, ...)
  15.                 myDB.test = ...;
  16.             end,
  17.         },
  18.     },
  19. }
  20.  
  21. ACR:RegisterOptionsTable("TestOption", testOption);
  22. ACD:AddToBlizOptions("TestOption", nil, nil);

For example, if I input |cFFFFFFFF|r



This will actually save ||cFFFFFFFF||r



Alternatively, I tried to use \124, but unfortunately, same thing still occurs.
(In this case it saves \\124, extra back slash, instead of \124 )

-- EDIT #1: Changed thread title

Looks like it is not AceConfig input field specific behaviour, but text editor in general.

Last edited by Lyak : 09-30-18 at 04:59 PM.
  Reply With Quote
09-30-18, 06:37 PM   #2
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,510
I might be wording this wrong, so it may get corrected

But, the extra / in strings are usually added to show that the following / is not part of a special character called an escape code. It may be a similar thing to | but I haven't used that outside of wow programming as special functionality to know if it is used in a similar capacity.

I hope that explains it well enough for you.
__________________
  Reply With Quote
10-01-18, 01:10 AM   #3
Lyak
A Cyclonian
Join Date: Jul 2018
Posts: 46
Originally Posted by Xrystal View Post
I might be wording this wrong, so it may get corrected

But, the extra / in strings are usually added to show that the following / is not part of a special character called an escape code. It may be a similar thing to | but I haven't used that outside of wow programming as special functionality to know if it is used in a similar capacity.

I hope that explains it well enough for you.
Hi Xrystal,

Now I did get the point of why it does such thing.

Thank you for your clarification

The next question would be, then how could I save and restore those escape sequences via in-game text editor.
  Reply With Quote
10-01-18, 04:04 AM   #4
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,510
Not sure as I haven't crossed that bridge myself. I would have assumed if wow wrote it to the data in that format it would understand it to read it back in correctly. Have you checked if it causes a problem when reading it back out ?

Otherwise, I would probably not save them but rather check what data they point at and put them in the relevant section of the data.

EG.

|c123456|r is a color string - I would read the string, see it has a |c in it and read the following characters in and assign them the relevant color code r,g,b,a and then stop when it hits |r and save it in a color table to and replace the string with something that can be validated myself such as COLOR[key] and replace COLOR[key] with the contents of COLOR[key] when restoring the data to the screen. Of course that is just theory and may not be physically possible in exactly this way.

Maybe someone has come across this and resolved the problem, or have a work around.
__________________
  Reply With Quote
10-01-18, 06:52 AM   #5
Lyak
A Cyclonian
Join Date: Jul 2018
Posts: 46
Originally Posted by Xrystal View Post
Not sure as I haven't crossed that bridge myself. I would have assumed if wow wrote it to the data in that format it would understand it to read it back in correctly. Have you checked if it causes a problem when reading it back out ?

Otherwise, I would probably not save them but rather check what data they point at and put them in the relevant section of the data.

EG.

|c123456|r is a color string - I would read the string, see it has a |c in it and read the following characters in and assign them the relevant color code r,g,b,a and then stop when it hits |r and save it in a color table to and replace the string with something that can be validated myself such as COLOR[key] and replace COLOR[key] with the contents of COLOR[key] when restoring the data to the screen. Of course that is just theory and may not be physically possible in exactly this way.

Maybe someone has come across this and resolved the problem, or have a work around.
Hi again Xrystal!

So, basically when I input |cFFFFFFFF|r through the text editor, then save it to SV, this will save ||cFFFFFFFF||r as I mentioned at the start. Then if I read it back (e.g. print(myDB.test)), this will print out |cFFFFFFFF|r which I'm guessing is because the client(?) is translating '||' to '|' as you've explained on your first comment.

I think I'll need a further experiment on this

-- EDIT #1

Alright, I think I got the temporary solution(?).

I'll just let it to save with those double slashes, but make it replace to single slash via string.gsub whenever I need to use it.

I think that's the cheapest work around haha !!

-- EDIT #2

Yeap, it's looking awkward, but at least it's working

Last edited by Lyak : 10-01-18 at 07:04 AM.
  Reply With Quote
10-01-18, 12:07 PM   #6
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,510
good to see you're getting it figured out. It's all a learning curve. I just had the added advantage of knowing some programming already. Some rules are the same regardless of how the language deals with it.
__________________
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » In-game text editor tends to saves extra vertical slash ('|') into SV

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