Text+
DevForum Topic
  • Welcome
  • Installation
  • Fundamentals
    • Introduction
    • Line breaks
    • Customization
      • Fonts
      • Scale-size
      • Truncation
    • Modification
    • Text bounds
  • Fine-control
    • Introduction
    • Full iteration
  • Specific indexing and iteration
  • Transform and style
  • Custom fonts
    • Introduction
    • Font to XML
    • XML to Lua
    • Upload font image
    • Import to Text+
Powered by GitBook
On this page
  • Simple way
  • Advanced way
  1. Fine-control

Full iteration

It's pretty simple to iterate through the text. Just make sure you respect your sorting.

Simple way

It's clean and intuitive to use the GetCharacters function, which will iterate through all characters. This function is optimized and respects all sorting types. You can simply iterate through the characters like this:

for characterNumber, character in TextPlus.GetCharacters(frame) do
	-- For Roblox fonts, 'character' will be a TextLabel.
	-- For custom fonts, 'character' will be an ImageLabel.
end

Advanced way

You can also manually loop through. This may be useful in certain cases.

Here's an example with full sorting on:

for lineNumber, line in frame:GetChildren() do
	-- 'line' will be a folder.
	for wordNumber, word in line:GetChildren() do
		-- 'word' will be a folder.
		for characterNumber, character in word:GetChildren() do
			-- For Roblox fonts, 'character' will be a TextLabel.
			-- For custom fonts, 'character' will be an ImageLabel.
		end
	end
end

If you have only one of the sorting types enabled, there will only be one layer of folders, and you'll have to do something like this:

for wordNumber, word in frame:GetChildren() do
	-- 'word' will be a folder.
	for characterNumber, character in word:GetChildren() do
		-- For Roblox fonts, 'character' will be a TextLabel.
		-- For custom fonts, 'character' will be an ImageLabel.
	end
end
PreviousIntroductionNextSpecific indexing and iteration

Last updated 5 days ago