set highlight color of lua basic functions in scintilla control

1.1k views Asked by At

I am using scintilla edit control in an MFC dialog based app.

I load scilexer.dll, and set the lexer to lua, but the only thing that is getting highlighted is the comments. I can also set keywords and they get highlighted:

mySciCtrl.SendMessage(SCI_SETKEYWORDS, 0, "for while end function")

However, I can not figure out how to enable highlighting of say lua basic functions like print, setmetatable, etc.

I thought that would be automatic just like the comments highlighting. Can anyone point me in the right direction?

1

There are 1 answers

0
user1452276 On

Found it, it was pretty trivial of course just needed to look at the scintilla functions. So, if anyone else runs into this:

in your scintilla window class initilize color by using SendMessage(SCI_STYLESETFORE, SCE_LUA_WORD2, RGB(100,149,237)); for a second list of keywords.

Then in your dialog do m_ScinCtrl.SendMessage( SCI_SETKEYWORDS, 1, ( long )_T( "the words you want highlighted with the above specified color"));

SCE_LUA_WORD2 corresponds to integer value 1 in the second statement so if you want a third set of keywords highlighted differently just use SCE_LUA_WORD3 and integer value 2 in the second statement!