FANDOM


-- Parses values from CSV file
-- Author: [[User:Shining-Armor]]
-- Version 0.0.1
 
local p = {}
 
-- Get content from the CSV file
local function load( page )
    return mw.title.new( page ):getContent()
end
 
-- Return a value from a CSV table
function p.getValue( frame )
    local content = load( frame.args[1] )
    local lines = mw.text.split(content, '\n')
    local keys = {}
    local i = 0
 
    -- Create table keys
    for k,v in pairs(lines) do
        keys[i] = mw.text.split(v, ',')
        i = i + 1
    end
 
    return keys[tonumber( frame.args[2] )][tonumber( frame.args[3] )]
end
 
return p