Module:Sandbox/Aidan9382
Appearance
Sandboxes:
- sandbox 1, sandbox 2.1 and sandbox 3, when one just doesn't cut it
- sandboxjson for unique pagetype testing
- sandboxmessy - the literal sandbox
- SafeEnvironmentTesting - somewhat defunct sandbox, still sometimes used for certain tests
Module:Sandbox/Aidan9382 - module coding
Any linter errors here are likely unintentional, and may be fixed
Subpages
Code analysis
Basic code analysis for Module:Sandbox/Aidan9382 | |
---|---|
Scope | Message |
Scope starting line 5 | data is defined but never referenced
|
Scope starting line 9 | data is defined but never referenced
|
Scope starting line 14 | data is defined but never referenced
|
Scope starting line 75 | t is defined but never referenced
|
Test invokes
This does nothing as of right now. 1748159170
Attempted to access unknown function 'notrealfunction'
parenting frame=Module:Sandbox/Aidan9382 parent1=Module:Sandbox/Aidan9382/doc mw.gct=Sandbox/Aidan9382
Frame arguments:
'1
' = 'a
'
'2
' = 'b
'
'3
' = 'c
'
Attempted to access unknown function 'testGP'
Attempted to access unknown function 'magicWordTests'
require('Module:Module wikitext')._addText('{{User:Aidan9382/sandbox/header|nolint=y}}')
require("strict")
local p = {}
function p.main(data)
return "<div style=text-align:right;font-size:80%>This does nothing as of right now. "..os.time().."</div>"
end
function p.iloveregexold(data)
local r = "%[?%[?.-:([^{|]+)%]?%]?"
local args = {mw.ustring.match("[[File:Hey.jpg|thumb|left|250px]]",r)}
return table.concat(args," -- ")
end
function p.iloveregex(data)
--This assumes [[ is present, and that therefore ]] is present
local r = "%[%[%a-:([^{|]+)(.+)%]%]"
local args = {mw.ustring.match("[[File:Hey.jpg|thumb|left|250px|All for [[Module:Excerpt/portals]]|alt=text]]",r)}
return table.concat(args," -- ")
end
function p.parentingLogic(frame)
--Note: Not even sure this thing goes beyond 1 parent, but have overcomplicated code anyways
local parentChain = {}
local newframe = frame
while true do
local parent = newframe:getParent()
if not parent then
break
end
newframe = parent
parentChain[#parentChain+1] = parent
end
local parentText = ""
for i,p in next,parentChain do
parentText = parentText .. " parent"..i.."="..p:getTitle()
end
return "frame="..frame:getTitle()..parentText.." mw.gct="..mw.title.getCurrentTitle().text
end
p["module-use"] = function(frame)
local parentLogicStuff = p.parentingLogic(frame)
local testlogic = "\n\n"
local i = 1
while true do
local c = frame.args["_test"..i]
if c then
testlogic = testlogic .. "_test"..i.."="..c
else
break
end
i = i + 1
end
return parentLogicStuff..testlogic
end
function p.getargs(frame)
local text = "Frame arguments:"
for k,v in pairs(frame.args) do
text = text .. "\n'<code>" .. mw.text.nowiki(k) .. "</code>' = '<code>" .. mw.text.nowiki(v) .. "</code>'"
end
return text
end
function p.testframe() --For the Debug console
local f = mw.getCurrentFrame()
f.getParent = function() return f end
return f
end
function p:namecall()
return self
end
return setmetatable(p,{
__index=function(t,k)
mw.log("Attempted to access unknown function '"..tostring(k).."'\n"..debug.traceback())
return function()
return "<span class=\"error\">Attempted to access unknown function '"..tostring(k).."'</span>"
--local frame = mw.getCurrentFrame()
--local traceback = frame:extensionTag("syntaxhighlight", debug.traceback(), {lang="text"})
--return "<span class=\"error\">Attempted to access unknown function '"..tostring(k).."'</span>\n"..traceback
end
end
})