I am creating a plugin, and for my plugin I need a way to edit a specific line of the source of a script.
I have tried to get the source and split it into lines using string.gmatch(source, “[^\n]+”), and it gives me a table with the lines of the code separated in strings, but when I check the length of the table it is not equal to the number of lines the script has, and when I try to use table.concat(lines, “\n”) to join the lines, it turns out that the empty lines are skipped. It is important that it give me all the lines of the script including the empty ones so I can edit a specific line with something like lines[5] = …
Any way to get it?, It maybe would help me to give me a table with all the lines, but that the empty lines are an empty string “” or a space “”, not nil.