Module:Electowidget: Difference between revisions
Content added Content deleted
(Adding a function to parse the abif contents) |
(Still futzing) |
||
Line 2: | Line 2: | ||
-- Date: ~~~~ |
-- Date: ~~~~ |
||
-- Comment: I think I'd like the new version of Electowidget to use ABIF |
-- Comment: I think I'd like the new version of Electowidget to use ABIF |
||
local p = {} |
local p = {} |
||
-- Function to parse the line and return a Lua native data structure |
-- Function to parse the line and return a Lua native data structure |
||
function p.parse_prefs_line(line) |
function p.parse_prefs_line(line) |
||
if not line or line == '' then |
|||
return {} |
|||
else |
|||
return line |
|||
end |
|||
local qty, prefs = line:match('(%d+):%s*(.*)') |
local qty, prefs = line:match('(%d+):%s*(.*)') |
||
local prefs_table = {} |
local prefs_table = {} |
||
Line 25: | Line 30: | ||
return { |
return { |
||
qty = tonumber(qty), |
qty = tonumber(qty), |
||
prefs = prefs_table, |
prefs = prefs_table or {}, |
||
comment = nil, |
comment = nil, |
||
orderedlist = true |
orderedlist = true |