உள்ளடக்கத்துக்குச் செல்

Module:Pn

கட்டற்ற கலைக்களஞ்சியமான விக்கிப்பீடியாவில் இருந்து.
Aswn (பேச்சு | பங்களிப்புகள்) பயனரால் செய்யப்பட்ட 06:01, 7 சூன் 2020 அன்றிருந்தவாரான திருத்தம் (en:Module:Pn இலிருந்து திருத்தங்கள் இறக்குமதி செய்யப்பட்டன)
(வேறுபாடு) ← பழைய திருத்தம் | புதிய திருத்தத்தைப் பார்க்கவும். (வேறுபாடு) | புதிய திருத்தம் → (வேறுபாடு)

Documentation for this module may be created at Module:Pn/doc

--[[
Module that returns one value from a list of unnamed parameters
Named parameter idx is the index of the parameter that is to be returned
Negative indices count backward from the end of the list
==]]

local p = {}

p.getVal = function(frame)
	local args = {}
	-- copy arguments from frame object and its parent
	for k, v in pairs(frame.args) do
		args[k] = v
	end
	for k, v in pairs(frame:getParent().args) do
		args[k] = v
	end
	if not args[1] then
		return nil
	end
	local idx = tonumber(args.idx) or 1
	if idx < 0 then idx = #args + idx + 1 end
	return args[idx]
end

return p
"https://ta.wikipedia.org/w/index.php?title=Module:Pn&oldid=2983019" இலிருந்து மீள்விக்கப்பட்டது