Search found 30 matches

by Golem
Sun Mar 31, 2013 11:37 pm
Forum: Help Forum
Topic: Lua Callbacks
Replies: 10
Views: 10730

Re: Lua Callbacks

Right, sorry for digging this up but: have callbacks been added to tempTrigger and it's companions?
They do work for tempTimer, but it does not seem they do for triggers.
by Golem
Sun Mar 31, 2013 10:52 am
Forum: Help Forum
Topic: Highlighting one Variable
Replies: 9
Views: 6262

Re: Highlighting one Variable

Right, it seems suggestions are not the way to go. No problem. Here is the full solution, simply paste this in: target = matches[2] if id then killTrigger(id) end id = tempRegexTrigger("(?i)" .. target, [[ selectString(matches[1], 1) fg("gold") resetFormat() ]]) Good luck, G.
by Golem
Sun Mar 31, 2013 1:36 am
Forum: Help Forum
Topic: Highlighting one Variable
Replies: 9
Views: 6262

Re: Highlighting one Variable

Try replacing selectString("]] .. target .. [[", with selectString(matches[2],
by Golem
Sun Mar 31, 2013 1:05 am
Forum: Help Forum
Topic: Highlighting one Variable
Replies: 9
Views: 6262

Re: Highlighting one Variable

I would have to see your modified code to answear as to why it is not working but my guess would be that the coloring code also needs to be changed - try selecting the matches of the temporary trigger instead of the target variable - remember that the match might be upper or lower case. As to my use...
by Golem
Sun Mar 31, 2013 12:22 am
Forum: Help Forum
Topic: Highlighting one Variable
Replies: 9
Views: 6262

Re: Highlighting one Variable

In what way? :) Do you want the exact code you need to solve your problem? Which part of my explanation is too convoluted? What I suggested was simply replacing your tempTrigger with tempRegexTrigger and beforehand adding a (?i) in front of the targets name. If you need more info on regular expressi...
by Golem
Sat Mar 30, 2013 10:17 pm
Forum: Help Forum
Topic: Table Remove
Replies: 9
Views: 5978

Re: Table Remove

I considered it, but it does remove only one occurence. Still, since mudlet already offers index_of it might offer table.removeelem while retaining backward compatibility by a simple assignment to listRemove :)
by Golem
Sat Mar 30, 2013 10:05 pm
Forum: Help Forum
Topic: Table Remove
Replies: 9
Views: 5978

Re: Table Remove

Table.remove does not accept the element, it accepts the key, which I'm sure you are aware of. So no, listRemove even though named poorly ;) does not duplicate table.remove functionality.

Sure, probably it could have been named table.removeelem... :)
by Golem
Sat Mar 30, 2013 9:37 pm
Forum: Help Forum
Topic: Table Remove
Replies: 9
Views: 5978

Re: Table Remove

Not to be nitpicky, since you said that those functions are left there for backwards compatibility, but usually it is better to use already included code, especially when it does exactly the same thing as the aforementioned solution using table.remove. On the other hand i do think that including som...
by Golem
Sat Mar 30, 2013 9:31 pm
Forum: Help Forum
Topic: Highlighting one Variable
Replies: 9
Views: 6262

Re: Highlighting one Variable

There are multiple solutions to your problem, but one of the simplest is I think using an case insensitive regex.

For example:
Code: [show] | [select all] lua
tempRegexTrigger("(?i)orc", ...)
will work for patterns like Orc, oRc, ORC, etc.

Good luck, G.
by Golem
Sat Mar 30, 2013 9:05 pm
Forum: Help Forum
Topic: Table Remove
Replies: 9
Views: 5978

Re: Table Remove

Interestingly enough there is a TableUtils.lua included in mudlet-lua, and therein you can find
such functions (not yet documented it seems) like listRemove. This would simplify your code to this:
Code: [show] | [select all] lua
listRemove(fociinarea, matches[2])
Good luck, G.