summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/getopts.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/getopts.lua b/lib/getopts.lua
index 0970e20..ee6a3c8 100644
--- a/lib/getopts.lua
+++ b/lib/getopts.lua
@@ -141,8 +141,14 @@ end
-- If filter is defined (and table is true), only list option matching filter
function getoptsfromfile (file, search_section, search_name, to_table, filter)
local opts = nil
- if not (fs.is_file(file)) then return nil end
- local conf_file = fs.read_file_as_array ( file )
+ local conf_file = {}
+ if (fs.is_file(file)) then
+ conf_file = fs.read_file_as_array ( file )
+ else
+ for line in string.gmatch(file, "(.*)\n") do
+ conf_file[#conf_file + 1] = line
+ end
+ end
local section = ""
local skip_lines = 0
for i,l in ipairs(conf_file) do