コンテンツにスキップ

あくまで管理人個人が勝手に書き殴っているメモなので、誤謬・誤植・誤解も含め、記述内容の正確性を一切保証しません。責任を負いません。問い合わせ等を受け付けません

これは、このWebサイトの読者が、このWebサイトにある記述内容を一方的・盲目的に信用したことが原因で、読者に事故や損害を与えた場合も含みます。万が一にも参考にする場合は、事前に読者による計算や実験を必須とします。ここでいう計算や実験が何であるかを理解できていない方は、まずそれを理解することから始めて下さい。なお、このWebサイトには、計算や実験が何であるかを理解できるような記述はありません。

各戸に引き込まれている商用電力はもちろん、市販されている電池を電源として使う場合でも、計算や操作の僅かなミスが事故や損害に繋がります。くれぐれも注意して下さい。

モジュール:If empty

提供: アナログ回路研究資料

このモジュールについての説明文ページを モジュール:If empty/doc に作成できます

local p = {}

function p.main(frame)
	local args = require('Module:Arguments').getArgs(frame, {wrappers = 'Template:Ifempty', removeBlanks = false})

	-- For backwards compatibility reasons, the first 8 parameters can be unset instead of being blank,
	-- even though there's really no legitimate use case for this. At some point, this will be removed.
	local lowestNil = math.huge
	for i = 8,1,-1 do
		if args[i] == nil then
			args[i] = ''
			lowestNil = i
		end
	end

	for k,v in ipairs(args) do
		if v ~= '' then
			if lowestNil < k then
				-- If any uses of this template depend on the behavior above, add them to a tracking category.
				-- This is a rather fragile, convoluted, hacky way to do it, but it ensures that this module's output won't be modified
				-- by it.
				frame:extensionTag('ref', '[[Category:テンプレート呼び出しエラーのあるページ/Template:Ifempty]]', {group = 'TrackingCategory'})
				frame:extensionTag('references', '', {group = 'TrackingCategory'})
			end
			return v
		end
	end
end

return p