Jump to content

Module:If empty

From Simple English Wikipedia, the free encyclopedia
Revision as of 18:51, 23 December 2014 by Codehydro (talk | changes) (lua doesn't cast nil into blank strings apparently)

This module supports Template:If empty.

Tracking/maintenance category


-- this is intended to replace {{If empty}}
local p = {};
function p.run(frame)
	local args = require('Module:Arguments').getArgs(frame)
	local i = 0
	args[table.getn(args)] = ''
	while args[i] == nil or string.len(args[i]) == 0 do
		i = i + 1
	end
	return args[i]
end
return p