I created a string called fonts
which stores a list of all of the fonts installed on the system, each separated by a newline:
local font = io.popen("fc-list | cut -d ' ' -f 2- | cut -d : -f 1 | cut -d , -f 1 | sort | uniq")
if font == nil then return end
local fonts = font:read("*a")
print(fonts)
font:close()
The output of printing it looks something like this:
Latin Modern Mono
Latin Modern Mono Caps
Latin Modern Mono Light
etc. I want to store it in a table instead. How can I get something like this:
local fonts = {
"Latin Modern Mono",
"Latin Modern Mono Caps",
"Latin Modern Mono light"
}