Module:Electowidget: Difference between revisions

Content added Content deleted
(Still futzing)
(Still futzing)
Line 4: Line 4:
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
if not line or line == '' then
return {}
return {}
else
return line
end
end


local qty, prefs = line:match('(%d+):%s*(.*)')
local qty, prefs = tostring(line):match('(%d+):%s*(.*)')
local prefs_table = {}
local prefs_table = {}


Line 19: Line 18:


local rank = 1
local rank = 1
if 1 == 1 then

return tostring(prefs)
end
for name, rating in prefs:gmatch('([^/]+)/([^ ]+)') do
for name, rating in prefs:gmatch('([^/]+)/([^ ]+)') do
prefs_table[rank] = {
prefs_table[rank] = {