Module:Collections

-- see: https://en.wikipedia.org/wiki/Wikipedia:Lua -- see: http://dev.wikia.com/wiki/Lua_reference_manual/Scribunto_libraries

local Coll = {}

-- inside current-local-frame (==table), define functions (of tbl-Coll{})... function Coll.originalgreeting(frame) -- this function creates/concats a string-to-print as retval...   -- note: calling METHOD table:funtion prepends self as arg like python...    -- whereas calling FCN named getParent.args[1] does not know it-self... local parent = frame:getParent local arg1 = parent.args[1] or frame.args[1] or "" local arg2 = parent.args[2] or frame.args[2] or "" local name = parent.args["name"] or frame.args["name"] or "" local choice = name .. " " .. arg1 .. " " .. arg2 --   choice = choice .. " plus-args?" .. frame.args[3] local retstr = "Greetings, " .. choice .. " !!!"   return retstr end -- stolen from final-fantasy-wikia... function Coll.ffwikireargs(f) -- this fcn makes frame-args into a regular table... local n = {} -- for k, v in pairs(f) do   for i, v in ipairs(f) do        if mw.text.trim(v) ~= "" then n[i] = v end end return n end function Coll.ffwikiprinttable(f) -- basic wiki-text print of simple table... local n = "" for k, v in pairs(f) do       n = n .. k .. ":" .. v .. " "   end return n end

-- hjf-style ideas of things-to-do/try...

function Coll.setup(f) local fargs = Coll.ffwikireargs(f) local parent = f:getParent local pargs = Coll.ffwikireargs(parent) -- return multiple values is subtle, see:https://www.lua.org/pil/5.1.html return fargs, pargs end function Coll.greeting(f) local c, cp = Coll.setup(f) local n = "" n = n .. "Frame =" .. Coll.ffwikiprinttable(c) n = n .. "Parent=" .. Coll.ffwikiprinttable(cp) return n end

-- from this module, return the whole frame-with-everything... -- however, a module-return implicitly calls tostring function... return Coll

-- eventually this will be able to transclude sections and fixup(?) categories -- see: https://en.wikipedia.org/wiki/Wikipedia:Transclusion#Special_pages