Jump to content

Module:Wnt/Templates/Sandbox

Unchecked
From Wikipedia

Documentation for this module may be created at Module:Wnt/Templates/Sandbox/doc

local p = {}
function extractentries(frame,debug)
    local cursor = nil
    local typearray = {}
    cursor = next (frame, cursor)
    debug = "tracking..."
    while (cursor) do
    typearray[cursor] =  type(frame[cursor])
    debug = debug .. cursor .. typearray[cursor]
    cursor = next (frame, cursor)
    end
    return typearray, debug
    end

function p.main(frame)
    local pframe=frame:getParent()
    local output = ""
    local typearray,debug=extractentries(frame,debug)
    for i,v in ipairs(typearray) do output = output .. i .. v end
    return output .. (#typearray or "Nothing found") .. debug
end

function p.stringtest(frame)
    local teststring="abcdafghaijkalmn"
    local y = ""
     for w in string.gmatch("==8== hello world from lua hello ==8==","==8==") do y=y .. "-" .. w end
     return y
end

function p.stringtest2(frame)
    local output = ""
    local teststring="<b><span style=\"font-size:300%\"><blink><iframe src=\"http://www.w3schools.com\"></iframe><img src=\"https://www.google.com/images/srpr/logo3w.png\"></blink></span></b><test>"
    for w in string.gmatch(teststring,"<.->") do
       output = output .. w
    end
    return "<nowiki><pre>" .. output .. "</pre></nowiki>"
end
           

return p