diff options
| author | ValleyKnight <[email protected]> | 2021-05-12 12:48:52 -0400 |
|---|---|---|
| committer | ValleyKnight <[email protected]> | 2021-05-12 12:48:52 -0400 |
| commit | 5c2381bfa1b31f25117cc42b0232cc219d1834ae (patch) | |
| tree | 00c97e70a30998f7ff7318803300f769cf58251f | |
| parent | f5a27a45d41d0d3b26a479d859a1fcdf0893b6e6 (diff) | |
more changes based on suggestion
| -rw-r--r-- | xmake/modules/package/manager/portage/find_package.lua | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/xmake/modules/package/manager/portage/find_package.lua b/xmake/modules/package/manager/portage/find_package.lua index dfb7a3b22..1b6eb27fe 100644 --- a/xmake/modules/package/manager/portage/find_package.lua +++ b/xmake/modules/package/manager/portage/find_package.lua @@ -52,18 +52,18 @@ function main(name, opt) -- create a table for the list local list_table = {} + -- split entries based on newlines - for entry in file_contents:gmatch("(.-)\n") do - -- then split those entries based on spaces - for split_entry in entry:gmatch("(.-) ") do - -- then append to the table if the entry contains a `/` - if string.match(split_entry, "/") then - table.insert(list_table, split_entry) - end - end + local entries = file_contents:split("\n") + + -- iterate over the table created by split() + for _, entry in pairs(entries) do + -- the file path is the second element after being delimited by spaces + local split_entry = entry:split(" ")[2] + table.insert(list_table, split_entry) end - -- create an initial empty string for the list + -- create a string out of list_table called list local list = table.concat(list_table, "\n") -- parse package files list |
