Hello, I’m trying to create a script editor for a game teaching how to script. The way I am going about it is I’m splitting the code up into lines that are frames, with each word being its own textbox. This will allow syntax highlighting. Problem is, I have found no way to get newlines from a string. I’m not talking about “\n” either, I’m talking:
local function wow()
How would I go about separating each individual newline?
I am confused about what are you trying to find but print() function alreday close each line in the output. The problem you may be facing is that you are printing out multiple same values which Roblox studio starts to count instead of printing it out each line.
I’m not trying to output anything. I’m trying to create an editor, and create a new frame for each line and put the lines in each one
Frankly speaking, I have no clue how to do this, but I do know that if your string spans multiple lines, the \n character will implicitly exist. You’ll need to iterate through your string with a pattern and match cases of \n to determine where a newline is made.
Some test code I ran on the Lua demo page:
local a = [[local function wow()
print(a:match("[^\n]*")) -- local function wow()
This should provide some direction as to what you should be doing. The code above finds one line of your string. The pattern set here is
[^\n]*. Use this, along with other string functions and possibly also loops, to find all the lines of your string and what they contain.
that works thank you! I’m just trying to basically split the string by newlines, without a physical “\n”
Ages ago I did some research into this and found this which may help you out a lot https://www.roblox.com/library/2600527777/Console.
You may want to rework it but here is a small demo.