Color one word within a replaced string

Post Reply
ililili
Posts: 10
Joined: Mon Jan 16, 2012 3:06 pm

Color one word within a replaced string

Post by ililili »

Code: Select all

Pattern: ^(\w+) leaves to the (\w+)\.$

Code:
if matches[2]:lower() == mysysvar.t then
  selectString(line, 1)
  setFgColor(175,0,0)
  replace("Target left -" .. matches[3] .. "-")
  resetFormat()
end
I want to color matches[3] differently than the rest of the string.

Sheia
Posts: 33
Joined: Tue Dec 01, 2009 4:40 am

Re: Color one word within a replaced string

Post by Sheia »

The following code works for me, however I'm new at this so this may not be the best way to go about it!
Code: [show] | [select all] lua
if matches[2]:lower() == mysysvar.t then
  selectString(line, 1)
  deleteLine()
  decho(string.format([[<175,0,0>Target left -<0,175,0>%s<175,0,0>-]],matches[3]))
end
Hope it helps!

Post Reply