Bug With permAlias and permRegexTrigger Functions

Post Reply
Jor'Mox
Posts: 1153
Joined: Wed Apr 03, 2013 2:19 am

Bug With permAlias and permRegexTrigger Functions

Post 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")]])

Laps
Posts: 27
Joined: Sat Feb 01, 2020 8:34 am

Re: Bug With permAlias and permRegexTrigger Functions

Post 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

User avatar
SlySven
Posts: 1034
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Bug With permAlias and permRegexTrigger Functions

Post 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...

Post Reply