Nick Gammon said:
I misunderstood your request then. You seemed to be talking about something in the Send box, not something to do with a GetInfo function, when used in an external script file, that returned the name of the last trigger match. What does that have to do with the Send box?
Sorry about that; I probably wasn't thinking very clearly at the time. (It's an often inconvenient fact that my ideas get more fleshed out over time, but they start out in a rather sorry state.)
My logic was kind of that, I wanted the user to be able to use a library function directly from the Send box without having to provide the name or the sequence number. It's equally viable from a script callback, too, but I always figured that it would be most likely used from within the Send box. You're right, the Send box is irrelevant to the idea itself; I'm sorry that confused you.
Your "Normal user" in this scenario needs:
To prefer lua.
It's the default language, and if they know enough to prefer another language, they can do it themselves. As I've said, this isn't a complex technique, but abstracting it into a simple "paint pie red" function makes it much easier for the less technically inclined. I've worked with plenty of people in the MUSHclient clan in Achaea, so I know exactly who I'm targeting.
Know to 'require "library"' (both how to, and that they can get it and want to)
Not hard, because you can put it in a trigger safely. This is how the wait library is often used, from what I see.
Know to give the trigger a label in the first place (If "normal user" leaves label blank, %N or the upvalue to the 1st parameter in the calling function (btw, they're not consistently named) a GetInfo selector returning "" doesn't help you at all.
Trigger callbacks return the internal label (ie. *trigger42), so a user-provided label is irrelevant.
I don't know how you expect to code a library that can distinguish what needs to be colored, in what color while "Ideally, the user shouldn't need to pass a thing here."
I want to make sure that, to the greatest extent I can manage it, it's obvious what the function is doing.
highlight("pie", "red", "green")
Isn't that just incredibly simple? And the last argument can be a table providing other options like italic, bold, case sensitive, etc., so there's a lot of expressiveness there.
If you're completely adamant about sparing this normal user this huge inconvenience; use GetTriggerList() to get the internal ID's of unnamed triggers (i.e. 14="*trigger9827") and make a table that's keyed on the match.
That doesn't work. It is very possible for two triggers t have the same match text, with different sequences, and if the library confuses the two, that constitutes a bug. (And quite a confusing one, at that.)