বিষয়বস্তুতে চলুন

মডিউল:If empty: সংশোধিত সংস্করণের মধ্যে পার্থক্য

From ওয়ার্ল্ডপিডিয়া, the free encyclopedia
lua doesn't cast nil into blank strings apparently
test: do I even need these lines?
১ নং লাইন: ১ নং লাইন:
-- this is intended to replace {{If empty}}
-- this is intended to replace {{If empty}}
local p = {};
function p.run(frame)
function p.run(frame)
local args = require('Module:Arguments').getArgs(frame)
local args = require('Module:Arguments').getArgs(frame)
১০ নং লাইন: ৯ নং লাইন:
return args[i]
return args[i]
end
end
return p

০১:০১, ২৪ ডিসেম্বর ২০১৪ তারিখে সংশোধিত সংস্করণ

এই মডিউলের জন্য মডিউল:If empty/নথি-এ নথিপত্র তৈরি করা হয়ে থাকতে পারে

-- this is intended to replace {{If empty}}
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