Module:If empty: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
Content added Content deleted
mNo edit summary
(lua doesn't cast nil into blank strings apparently)
Line 5:
local i = 0
args[table.getn(args)] = ''
while 0args[i] == nil or string.len(args[i]) == 0 do
i = i + 1
end

Revision as of 18:51, December 23, 2014

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