Jump to content

Module:Sandbox/Yurik

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Yurik (talk | contribs) at 23:35, 8 December 2016 (Created page with 'local p = {} function p.data( frame ) return p._impl(frame.args[1]) end function p.dbg( frame ) return mw.text.jsonEncode( mw.ext.data.get( frame.args[1],...'). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
local p = {}

function p.data( frame )
    return p._impl(frame.args[1])
end

function p.dbg( frame )
	return mw.text.jsonEncode( mw.ext.data.get( frame.args[1], frame.args[2] ), mw.text.JSON_PRETTY )
end

function p._impl( page )
	local result = {}
	for key, row in pairs(mw.ext.data.get(page).data) do 
		table.insert(result, "* '''" .. row[0] .. "''': " .. row[1] .. " in stock<br>" ) 
	end
	return table.concat(result, "\n")
end

return p