- New Objects (Flexbox, Graph, Treeview) - Pluginsystem to add/remove functionality - Reworked the entire Object system, instead of one big Object Class we have multiple classes: Object, VisualObject, ChangeableObject - Instead of one big Frame Class we have multiple Frame Classes: BaseFrame, Frame, MovableFrame, ScrollableFrame, MonitorFrame, Flexbox - Removed the Animation Object, and added a animation plugin instead - Removed the Graphic Object and merged it's functionality with the image object - Updated currently existing objects
1.3 KiB
1.3 KiB
addKeywords
Description
Adds keywords for special coloring in a Textfield object. This allows you to highlight specific words with a chosen color.
Parameteres
number|colorcolor - The color you want to apply to the keywordstablekeywords - A list of keywords that should be colored, for example: {"if", "else", "then", "while", "do", "hello"}
Returns
objectThe object in use
Usage
- Changes the color of specific words to purple in a Textfield object:
local basalt = require("basalt")
local mainFrame = basalt.createFrame()
local aTextfield = mainFrame:addTextfield()
aTextfield:addKeywords(colors.purple, {"if", "else", "then", "while", "do", "hello"})
basalt.autoUpdate()
In this example, a Textfield object is created and added to the mainFrame. The addKeywords method is called to add a list of keywords to be highlighted in purple color. The specified keywords are "if", "else", "then", "while", "do", and "hello".
<textfield>
<keywords>
<purple>
<keyword>if</keyword>
<keyword>else</keyword>
<keyword>then</keyword>
<keyword>while</keyword>
<keyword>do</keyword>
<keyword>hello</keyword>
</purple>
</keywords>
</textfield>