Capil ka isi

Modul:if empty

Matan Wiktionary

Dokumentasi untuk modul ini dapat dibuat di Modul:if empty/doc

-- Imported from enwiktionary
-- Source: https://en.wiktionary.org/wiki/Module:if empty
-- License: CC BY-SA

-- Prevent substitution.
if mw.isSubsting() then
	return require("Module:unsubst")
end

local export = {}

-- Do all the work via [[Module:parameters]], as it returns a list of parameters
-- with any gaps removed, treating blank parameters as gaps, so simply return
-- the first value, falling back to the empty string. Blank parameters are
-- (obviously) permitted, but missing ones are not (i.e. using named parameters
-- to specify non-contiguous numeric parameters like |1000=).
function export.main(frame)
	return require("Module:parameters").process(frame:getParent().args, {
		[1] = {list = true, disallow_missing = true}
	})[1][1] or ""
end

return export