Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Test2: Difference between revisions

From ProleWiki, the proletarian encyclopedia
m (Using raw os.time() function)
mNo edit summary
Line 1: Line 1:
function splitLines(text)
    local lines = {}
    for line in text:gmatch("[^\r\n]+") do
        table.insert(lines, line)
    end
    return lines
end
local p = {}
local p = {}


function p.randomNumber(frame)
function p.Sitename(frame)
math.randomseed(os.time())
local extDataTable = mw.ext.externalData.getExternalData(frame.args[1])[1]["__text"]
local min = tonumber(frame.args[1]) or 0
local lines = splitLines(extDataTable)
local max = tonumber(frame.args[2]) or 100
-- first check for matching "og:site_name"
return math.random(min, max)
-- match("content=\"(%a+)\"") needs to be somewhere
end
end


return p
return p

Revision as of 11:55, 23 April 2024

function splitLines(text)
    local lines = {}
    for line in text:gmatch("[^\r\n]+") do
        table.insert(lines, line)
    end
    return lines
end

local p = {}

function p.Sitename(frame)
	local extDataTable = mw.ext.externalData.getExternalData(frame.args[1])[1]["__text"]
	local lines = splitLines(extDataTable)
	-- first check for matching "og:site_name"
	-- match("content=\"(%a+)\"") needs to be somewhere
end

return p