In Lua Learning, there’s a script editor in-game where you can write code just like an actual script editor. I tried to make one myself but I just found it too confusing.
What I want to achieve is that richtext that is made when you put code in.
For the syntax highlighting part, the first thing you’ll need is a lexer (lexical analyzer), which will be able to tokenize the source (script) and yield back keywords such as things like: number, comment, operator, built-in function etc. that can then be used to change the color of the desired words (parts of the provided source). Each tokens’ source text color can be changed using a separate textlabel (for different colors), or when we get rich text support, which seems to be soon, you could use that and it should make things even easier.
There are a many ways you can write your own lexer, but maybe doing some research on how lexers work and can be built in general might help?
To render the text, @boatbomber has said before that he had to parse the text into a million TextLabels and ImageLabels for his editor. RichText support has been discussed so we may be able to skip the million text labels and just be able to parse context in the future and apply different effects to them.
So first step is Lexer, second step is a bunch of text label generation. Or waiting