Module:If empty: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
Content added Content deleted
(test)
 
(oh, misread doc; thought opposite purpose for template)
Line 5: Line 5:
local i = 0
local i = 0
args[table.getn(args)] = ''
args[table.getn(args)] = ''
while string.len(args[i]) do
while not string.len(args[i]) do
i = i + 1
i = i + 1
end
end

Revision as of 18:42, 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 not string.len(args[i]) do
		i = i + 1
	end
	return args[i]
end
return p