Modul:Debug

This is [[MediaWiki:Tagline]]. Set to <code>display:none</code> by chameleon skin.
Version vom 15. Oktober 2015, 21:49 Uhr von imported>Oetterer
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Wechseln zu:Navigation, Suche
Documentation icon Module documentation[view] [edit] [history] [purge]

This is a module that can be used for testing purposes.

Usage

{{#invoke:Debug|function_name}}

local classDebug = require('Module:Debug/class')
local p = {}

function p.runTest(frame)
	local myCargoUtil = require('Module:CargoUtil')
	local myTableTools = require('Module:TableTools')
	--[==[
	local query = { tables = 'configuration_setting', fields = { 'default_value', 'description', 'is_unset', 'name', 'parent', 'type' }, where = 'parent = "Extension:Cargo"', }
	local attributes = {}
	--local str = myCargoUtil.rawquery('extension', nil, {'name', 'is_default'}, nil, nil, nil, nil, attributes)
	local t = myCargoUtil.query(query, attributes)
	--return '<pre>' .. mw.text.nowiki(str) .. '</pre><br><pre>' .. myTableTools.printTable(t) .. '</pre>' .. classDebug:printLog(9)
	return '<pre>' .. myTableTools.printTable(t) .. '</pre>' .. classDebug:printLog(9)
	
	local Class = require('Module:Instance extension/class')
	local test = Class:new('Instanz:Test', 'Extension:Cargo')
	local test2 = Class:new('Instanz:Test', 'Extension:SyntaxHighlight GeSHi')
	return tostring(test:sfGenerateForm()) .. tostring(test2:sfGenerateForm()) .. classDebug:printLog(9)
	]==]
	local Class = require('Module:Instance extension/class')
	local test = Class:new('Instanz:Test', 'Extension:Cargo')
	local e_query = {
			tables = 'extension',
			fields = { 'description', 'documentation_link', 'include_command', 'is_default', 'restricted_to' },
			where = '_pageName = "Extension:Cargo"',
		}
	local result = myCargoUtil.query(e_query)
	local Class = require('Module:Extension/class')
	obj = Class:new('Extension:Cargo')
	obj:initMyself()
	obj:addPageBody()
	obj:addInfobox()
	return obj:render() .. tostring(test:sfGenerateForm()) .. myTableTools.printTable(result)
end

function p.printLog(frame)
	local llevel = frame.args[1] or frame.args.llevel or 1
	llevel = tonumber(llevel)
	return classDebug:printLog(llevel)
end

return p