local debuglog="\n:debuglog:"local valid,duty=,
local function show(table) local r=" table: " for k,v in pairs(table) do r=r..k..":"..tostring(v).."; " end return rend
local function len(table) local r=0 for k,_ in pairs(table) do r=r+1 end return rend
local function Scanner(key,buf) -- returns anonymous function to scan a single table entry local pos=0 return function(beg) pos=beg or pos+1 local k=key[pos]; local v=buf[k] if valid[k] then debuglog=debuglog..pos..":"..k..":"..valid[k]..":"..v.." | " end return pos, k, v, valid[k] endend
local function class(value) return type(value) -- to be replacedend local function TemplArgs(table) -- initialising tables key, buf - InitArgsClasses to be launched first local key,buf=,; local pos=0; local d=len(duty) debuglog=debuglog.." #duty:"..d.." "..show(duty) for k,v in pairs(table) do if not valid[k] then debuglog=debuglog.."
local function InitArgsClasses(table) -- initialising tables valid, duty - todo: get argument classes from template page valid= duty=end
local p=function p.main(frame) InitArgsClasses(frame.args) local key,buf=TemplArgs(frame:getParent.args) local S=Scanner(key,buf) local p,k,v,c=S; local a="" while c do a=a..p..":"..k..":"..v.."; " -- ...handle... -> wikitext[k] (table of strings) p,k,v,c=S end return a..debuglogendreturn p