Difference between revisions of "Module:Ruler"

From The Kingkiller Chronicle Wiki
Jump to navigation Jump to search
(Created page with "-- <nowiki> local p = {} function p.location(frame) local lines = mw.text.split(frame.args[1], '*') local result = '' for k, v in ipairs(lines) do v = mw....")
 
(oops)
Line 2: Line 2:
 
local p = {}
 
local p = {}
  
function p.location(frame)
+
function p.ruler(frame)
 
     local lines = mw.text.split(frame.args[1], '*')
 
     local lines = mw.text.split(frame.args[1], '*')
 
     local result = ''
 
     local result = ''

Revision as of 21:32, 15 December 2018

Documentation for this module may be created at Module:Ruler/doc

-- <nowiki>
local p = {}

function p.ruler(frame)
    local lines = mw.text.split(frame.args[1], '*')
    local result = ''
    for k, v in ipairs(lines) do
        v = mw.text.trim(v)
        if v ~= '' then
            result = result .. '[[Category:Locations ruled by ' .. v .. ']]'
        end
    end
    return result
end

return p