Page 1 of 1

Bug With permAlias and permRegexTrigger Functions

Posted: Mon Aug 06, 2018 1:22 pm
by Jor'Mox
I was testing something out and used these functions with the command line, and noticed that the objects that they created could not be deleted until after I closed the profile and reopened it, and I'm unsure as to why.

Also, just using the permAlias function also created a numbered list of all existing tempAlias objects (which disappeared when I closed and reopened the profile).

For reference, the exact commands that I used are as follows:
lua permAlias("test","","^test$",[[print("blah")]])
lua permRegexTrigger("test","",{"^test$"},[[print("blah")]])

Re: Bug With permAlias and permRegexTrigger Functions

Posted: Tue May 05, 2020 6:44 am
by Laps
+1 I am also experiencing this bug today, except:
  • by "closing/reopening the profile" I think you might mean the Script Editor window.
  • it seems nothing in the Script Editor window may be deleted after this point, before closing/reopening it
Also, I believe this bug also can cause data loss in some scenarios, where the profile isn't saved properly -- I'm not sure how to reproduce this exactly though (maybe I just forgot to save before closing the Settings window).

In case it's helpful, here is my alias:

Pattern:

Code: Select all

^#alias (\S*) (.+)$
Body:

Code: Select all

if exists(matches[2], "alias") == 1 then
    cecho("<cyan>---- ALIAS ALREADY EXISTS: " .. matches[2]);
    return;
end

permAlias(
    "" .. matches[2],
    "",
    "^" .. matches[2] .. "(.*)$",
    [[expandAlias("]] .. matches[3] .. [[" .. matches[2]);]]);
...and then on the command line, you can enter this to create an example alias:

Code: Select all

#alias foo bar

Re: Bug With permAlias and permRegexTrigger Functions

Posted: Fri May 15, 2020 5:40 am
by SlySven
demonic is probably going to start jumping up and down when he sees this! :roll: :lol:

expandAlias(...) has got to be the most abused function that we provide - except that this might actually be one of those cases where it enables something that cannot easily be done on the command line otherwise. Other than that I am not sure I can comment further until this has been considered more thoroughly...