Module:Guidance: Difference between revisions
Jump to navigation
Jump to search
imported>Pingu (Created page with "local p = {} --p stands for package function p.reasons(frame) rs = {} rs[1] = "graphic violence or gore"; rs[2] = "flashing images"; rs[3] = "jump scares"; rs[4] = "sexual content"; rv = {}; rv[1] = "flashing" rv[2] = "graphic" rv[3] = "jumpscare" rv[4] = "sexual" for i = 4,1,-1 do if string.find(frame.args[1], rv[i]) then if ro == nil then ro = rs[i] elseif string.find(ro,",...") |
imported>Pingu No edit summary |
||
| Line 1: | Line 1: | ||
local p = {} --p stands for package | local p = {} --p stands for package | ||
rs = {} | |||
rs[1] = "graphic violence or gore"; | |||
rs[2] = "[[:wikipedia:photosensitive epilepsy|flashing images]]"; | |||
rs[3] = "[[:wikipedia:jump scare|jump scares]]"; | |||
rs[4] = "sexual content"; | |||
rv = {}; | |||
rv[1] = "flashing" | |||
rv[2] = "graphic" | |||
rv[3] = "jumpscare" | |||
rv[4] = "sexual" | |||
function p.reasons(frame) | function p.reasons(frame) | ||
for i = 4,1,-1 | for i = 4,1,-1 | ||
| Line 26: | Line 27: | ||
end | end | ||
end | end | ||
return ro | |||
end | |||
function p.warn1(frame) | |||
if string.find(frame.args[1], rv[1] or rv[3]) then | |||
rw1 = 1 | |||
end | |||
return rw1 | |||
end | |||
return | function p.warn2(frame) | ||
if string.find(frame.args[1], rv[2] or rv[4]) then | |||
rw2 = 1 | |||
end | |||
return rw2 | |||
end | end | ||
return p | return p | ||
Revision as of 04:27, 21 November 2022
Documentation for this module may be created at Module:Guidance/doc
local p = {} --p stands for package
rs = {}
rs[1] = "graphic violence or gore";
rs[2] = "[[:wikipedia:photosensitive epilepsy|flashing images]]";
rs[3] = "[[:wikipedia:jump scare|jump scares]]";
rs[4] = "sexual content";
rv = {};
rv[1] = "flashing"
rv[2] = "graphic"
rv[3] = "jumpscare"
rv[4] = "sexual"
function p.reasons(frame)
for i = 4,1,-1
do
if string.find(frame.args[1], rv[i]) then
if ro == nil then
ro = rs[i]
elseif string.find(ro,", and") then
ro = rs[i]..", "..ro
else
ro = rs[i]..", and "..ro
end
end
end
return ro
end
function p.warn1(frame)
if string.find(frame.args[1], rv[1] or rv[3]) then
rw1 = 1
end
return rw1
end
function p.warn2(frame)
if string.find(frame.args[1], rv[2] or rv[4]) then
rw2 = 1
end
return rw2
end
return p