05是什么生肖| 梦见猫是什么预兆| pct是什么意思| 嘴里苦是什么原因| 胃胀气打嗝是什么原因| 什么时候入伏| 青筋暴起是什么原因| 柿子与什么食物相克| 尿里有潜血是什么原因| 东是什么生肖| 尿酸高挂什么科| 什么是脚气| 围魏救赵是什么意思| 闷骚男是什么意思| 琉璃和玻璃有什么区别| 95什么意思| 腺病毒吃什么药| 荆芥不能和什么一起吃| 凯字五行属什么| 甲状腺偏高有什么影响| 肾在五行中属什么| 慕名而来是什么意思| 血细胞分析五分类是查什么的| 瑞字属于五行属什么| 打开图片用什么软件| 急性胰腺炎吃什么药| 阴虚吃什么药效果最好| 子宫内膜手术后需要注意什么| 白羊座的幸运色是什么| 梁五行属什么| 扑街是什么意思| 清新的什么填空| 蜈蚣最怕什么| 阴道里面痒用什么药| 胸胀痛什么原因| 大放厥词是什么意思| 舌根起泡是什么原因| 玉兰片和竹笋有什么区别| 脉跳的快是什么原因| 肝腹水是什么症状| 肾内科是看什么病的| 国潮是什么| 气血不足吃什么中药| 什么是艾滋病| ff是什么牌子| 什么东西最补心脏| 吃什么流产最快| 涤纶是什么面料| 田螺吃什么食物| 口干是什么原因引起的怎么治疗| 脚麻看什么科室最好| 拔牙可以吃什么| 劫财是什么意思| 球拍状胎盘对胎儿有什么影响| 角瓜是什么| 巴卡是什么意思| 舌根白苔厚是什么原因| 梦见自己输液是什么意思| 感冒拉肚子吃什么药| mw是什么单位| 禾字五行属什么| 阴道口有点痒用什么药| 这是什么踏板| 男性性功能减退吃什么药| 墓志铭是什么意思| 性功能下降吃什么药好| 做头发是什么意思| 两点一线是什么意思| 口臭是什么原因| vaude是什么品牌| 例假推迟是什么原因| 什么是相向而行| 为什么减肥一直减不下来| 九门提督相当于现在什么官| 想吃辣的是什么原因| 什么窃什么盗| 肺气囊是什么病| 中性粒细胞偏低是什么意思| 小腹疼痛什么原因| 阎维文什么军衔| 招财进宝是什么生肖| 激光点痣后需要注意什么| 6月1日是什么星座| 1976年五行属什么| 女性尿路感染吃什么药效果好| 胃炎应该吃什么药| 败血症是什么病| 气血不足吃什么药最好| 北芪煲汤加什么药材好| 女孩名字带什么字好听| 戊型肝炎是什么病| 五灵脂是什么| 突然想吐是什么原因| 电饭煲什么内胆最好| 梦见白猫是什么预兆| 自然什么意思| 鸣字五行属什么| 牙龈萎缩吃什么药见效快| 西安机场叫什么名字| 去极化是什么意思| 特应性皮炎用什么药膏| 散瞳后需要注意什么| 颈椎病吃什么药最好| 养膘是什么意思| 喝红茶对身体有什么好处| kappa是什么牌子| 本科生是什么意思| 前三个月怀孕注意什么| 胃不好的人适合吃什么水果| 为什么老是出汗| 歧视什么意思| 比心什么意思| 距离感是什么意思| cln是什么意思| mk是什么牌子| lv是什么意思| 兔日冲鸡什么意思| 不耐受和过敏有什么区别| 脾与什么相表里| 双飞什么意思| 查血型挂什么科| 百香果是什么季节的| 摆架子是什么意思| 思觉失调是什么意思| 吊丝是什么意思| seconds是什么意思| 肝喜欢什么食物| 为什么鼻子无缘无故流鼻血| 出水痘能吃什么食物| 祸起萧墙是什么意思| 脾胃虚寒吃什么食物好| 缺维生素e有什么症状| 铂金是什么颜色| 什么是良心| 甲醇对人体有什么伤害| 肠子粘连有什么办法解决| 脾胃虚弱吃什么中药| 什么叫皈依| 湿疹要注意什么| 什么牌子的空调好用又省电| 科学家是干什么的| 随时随地是什么意思| 滑胎是什么意思| 情商是什么| 肾气不足吃什么中成药| 宴字五行属什么| 什么是蝴蝶宝宝| 819是什么意思| 血压低吃什么补得最快| 谷丙转氨酶是什么意思| 中央处理器由什么组成| 生动形象是什么意思| 美国的国球是什么| 食言是什么意思| 万病之源是什么| 转的第三笔是什么| 92年出生属什么| 人为什么要生孩子| 看牙挂什么科| 骨髓纤维化是什么病| 灵芝泡水喝有什么功效| 沙漏是什么意思| 腊肉炒什么最好吃| 为人是什么意思| 胆汁反流是什么症状| 呛是什么意思| 不可名状的名是什么意思| 飞机什么不能带| 静脉曲张吃什么中成药| 知了猴什么时候出来| 过期酸奶有什么用| 珊瑚虫属于什么动物| 胸腔积液是什么意思| 属猪与什么属相相合| ptt是什么| 左侧后背疼是什么原因男性| 早退是什么意思| 言字旁的字和什么有关| 耳膜穿孔吃什么长得快| 翻墙是什么| a1微球蛋白偏高说明什么意思| 偏头痛吃什么药见效快| 胃糜烂要吃什么药| 沙眼是什么原因引起的| dx是什么意思| 分拣员是做什么的| 升结肠ca是什么意思| 香蕉有什么作用与功效| 执业药师证有什么用| 铁观音属于什么茶类| 吃避孕药有什么危害| 毓字五行属什么| 尿潜血挂什么科| 瓶颈期什么意思| 打开什么| 伊字五行属什么| 湿疹擦什么药膏好| 红花对什么| 腰肌劳损有什么症状| newear是什么牌子| 什么饼不能吃| 急性胃炎吃什么药好| 什么是消融手术| 双星座是什么意思| 低血糖什么不能吃| 什么是乐高| 3月5号是什么星座| 维生素c十一什么意思| 三伏天要注意什么| 王者风范是什么意思| 女性肾虚吃什么补最好最快| 深沉是什么意思| 止血芳酸又叫什么名| 车抛锚是什么意思| 身上搓出来的泥是什么| 什么原因导致打嗝| 立夏什么时候| 梦到小孩子是什么意思| 嘴苦吃什么药| 血糖高吃什么降血糖| 发好人卡是什么意思| 梦见煮鱼有什么预兆| mpv什么意思| 今日冲什么生肖| 主治医生是什么级别| 什么叫做洗钱| 天秤座是什么星座| 然五行属性是什么| 男朋友有什么用| 腊八蒜为什么是绿色的| 心急是什么病的症状| 尿隐血是什么意思| ckd3期是什么意思| 红领巾的含义是什么| 七一年属什么生肖| 女生不来大姨妈是什么原因| 大便干硬是什么原因| 喝什么对肾好| 怀孕皮肤变差什么原因| 苕皮是什么做的| 23333是什么意思| 赖氨酸是什么| 门槛石有什么讲究| 广藿香是什么味道| 包皮是什么| 子五行属什么| 金字旁的字与什么有关| 大头虾是什么意思| 一直嗝气是什么原因| 超声波是什么原理| 身份证穿什么颜色的衣服| 血管瘤是什么样子的图| 哮喘病是什么引起的| 左侧头疼是什么原因引起的| pure什么意思| 小便分叉是什么症状| 梦见掉了三颗牙齿是什么意思| fl表示什么意思| homme是什么意思| 腐女什么意思| hoka跑鞋中文叫什么| chd医学上是什么意思| 4岁打什么疫苗| 抚摸是什么意思| 百度Idi na sadr?aj

专访《中国诗词大会》总导演:展现人生诗歌故事

S Wikipedije, slobodne enciklopedije
Dokumentacija modula[uredi] [historija] [osvje?i ke?]
Ova dokumentacija je prikazana u Modul:Arguments/dok.
百度 17+27=等于整整44分!这两场比赛之间,发生了什么吗?一是主客场互换;二是首回合两队前一轮比赛均在48小时以前进行,从体能和备战时间看处于同一起点,而次回合高速的前一轮比赛早打一天,比上海多休息24小时,享有以逸待劳之优。

Ovaj modul omogu?ava lahko procesiranje argumenata koji prolaze kroz #invoke. Ovo je meta-modul, ?to zna?i da je napravljen da se koristi u drugim modulima i da se nebi trebao koristiti preko #invoke direktno. Funkcije ovog modula su u me?u ostalom:

  • Skra?ivanje argumenata i uklanjanje praznih argumenata.
  • Argumenti se mogu poslati kroz trenutni okvir (= frame) i preko okvira roditelja istovremeno. (vi?e detalja ispod)
  • Argumenti se mogu poslati direktno preko druge Lua module ili preko konzole za pronala?enje gre?aka u kodu.
  • Argumenti se mogu u?itati po potrebi, ?to poma?e da se izbjegnu (neki) problemi sa <ref>...</ref> oznakama.
  • Ve?ina funkcija se mo?e podesiti.

Osnovno kori?tenje

Prvo je potrebno u?itati modul. Koristi se jedna funkcija sa imenom getArgs.

local getArgs = require('Module:Arguments').getArgs

U najjednostavnijem scenariju getArgs se mo?e koristiti u main funkciji. Promjenljiva args je tabela koja sadr?i argumente od #invoke-a.

local getArgs = require('Module:Arguments').getArgs
local p = {}

function p.main(frame)
	local args = getArgs(frame)
	-- Glavni kod modula ide ovdje.
end

return p

Me?utim, preporu?eno je koristiti funkciju samo za procesiranje argumenata kroz #invoke. Ovo zna?i da ako neko pozove tvoj modul preko druge Lua module, onda nije potrebno imati okvirni objekat, pobolj?avaju?i brzinu izvr?enja.

local getArgs = require('Module:Arguments').getArgs
local p = {}

function p.main(frame)
	local args = getArgs(frame)
	return p._main(args)
end

function p._main(args)
	-- Glavni kod modula ide ovdje.
end

return p

Ako ?eli? da vi?e funkcija koriste argumente, i ako je potrebno da su oni dostpuni preko #invoke-a, onda se mo?e koristiti omotna funkcija.

local getArgs = require('Module:Arguments').getArgs

local function makeInvokeFunc(funcName)
	return function (frame)
		local args = getArgs(frame)
		return p[funcName](args)
	end
end

local p = {}

p.func1 = makeInvokeFunc('_func1')

function p._func1(args)
	-- Kod za prvu funkciju ide ovdje.
end

p.func2 = makeInvokeFunc('_func2')

function p._func2(args)
	-- Kod za drugu funkciju ide ovdje.
end

return p

Opcije

Dostupne su sljde?e opcije.

local args = getArgs(frame, {
	trim = false,
	removeBlanks = false,
	valueFunc = function (key, value)
		-- Kod za procesiranje jednog argumenta
	end,
	frameOnly = true,
	parentOnly = true,
	parentFirst = true,
	readOnly = true,
	noOverwrite = true
})

Skra?ivanje i uklanjanje praznih argumenata


-- This module provides easy processing of arguments passed to Scribunto from
-- #invoke. It is intended for use by other Lua modules, and should not be
-- called from #invoke directly.

local libraryUtil = require('libraryUtil')
local checkType = libraryUtil.checkType

local arguments = {}

-- Generate four different tidyVal functions, so that we don't have to check the
-- options every time we call it.

local function tidyValDefault(key, val)
	if type(val) == 'string' then
		val = val:match('^%s*(.-)%s*$')
		if val == '' then
			return nil
		else
			return val
		end
	else
		return val
	end
end

local function tidyValTrimOnly(key, val)
	if type(val) == 'string' then
		return val:match('^%s*(.-)%s*$')
	else
		return val
	end
end

local function tidyValRemoveBlanksOnly(key, val)
	if type(val) == 'string' then
		if val:find('%S') then
			return val
		else
			return nil
		end
	else
		return val
	end
end

local function tidyValNoChange(key, val)
	return val
end

local function matchesTitle(given, title)
	local tp = type( given )
	return (tp == 'string' or tp == 'number') and mw.title.new( given ).prefixedText == title
end

local translate_mt = { __index = function(t, k) return k end }

function arguments.getArgs(frame, options)
	checkType('getArgs', 1, frame, 'table', true)
	checkType('getArgs', 2, options, 'table', true)
	frame = frame or {}
	options = options or {}

	--[[
	-- Set up argument translation.
	--]]
	options.translate = options.translate or {}
	if getmetatable(options.translate) == nil then
		setmetatable(options.translate, translate_mt)
	end
	if options.backtranslate == nil then
		options.backtranslate = {}
		for k,v in pairs(options.translate) do
			options.backtranslate[v] = k
		end
	end
	if options.backtranslate and getmetatable(options.backtranslate) == nil then
		setmetatable(options.backtranslate, {
			__index = function(t, k)
				if options.translate[k] ~= k then
					return nil
				else
					return k
				end
			end
		})
	end

	--[[
	-- Get the argument tables. If we were passed a valid frame object, get the
	-- frame arguments (fargs) and the parent frame arguments (pargs), depending
	-- on the options set and on the parent frame's availability. If we weren't
	-- passed a valid frame object, we are being called from another Lua module
	-- or from the debug console, so assume that we were passed a table of args
	-- directly, and assign it to a new variable (luaArgs).
	--]]
	local fargs, pargs, luaArgs
	if type(frame.args) == 'table' and type(frame.getParent) == 'function' then
		if options.wrappers then
			--[[
			-- The wrappers option makes Module:Arguments look up arguments in
			-- either the frame argument table or the parent argument table, but
			-- not both. This means that users can use either the #invoke syntax
			-- or a wrapper template without the loss of performance associated
			-- with looking arguments up in both the frame and the parent frame.
			-- Module:Arguments will look up arguments in the parent frame
			-- if it finds the parent frame's title in options.wrapper;
			-- otherwise it will look up arguments in the frame object passed
			-- to getArgs.
			--]]
			local parent = frame:getParent()
			if not parent then
				fargs = frame.args
			else
				local title = parent:getTitle():gsub('/sandbox$', '')
				local found = false
				if matchesTitle(options.wrappers, title) then
					found = true
				elseif type(options.wrappers) == 'table' then
					for _,v in pairs(options.wrappers) do
						if matchesTitle(v, title) then
							found = true
							break
						end
					end
				end

				-- We test for false specifically here so that nil (the default) acts like true.
				if found or options.frameOnly == false then
					pargs = parent.args
				end
				if not found or options.parentOnly == false then
					fargs = frame.args
				end
			end
		else
			-- options.wrapper isn't set, so check the other options.
			if not options.parentOnly then
				fargs = frame.args
			end
			if not options.frameOnly then
				local parent = frame:getParent()
				pargs = parent and parent.args or nil
			end
		end
		if options.parentFirst then
			fargs, pargs = pargs, fargs
		end
	else
		luaArgs = frame
	end

	-- Set the order of precedence of the argument tables. If the variables are
	-- nil, nothing will be added to the table, which is how we avoid clashes
	-- between the frame/parent args and the Lua args.
	local argTables = {fargs}
	argTables[#argTables + 1] = pargs
	argTables[#argTables + 1] = luaArgs

	--[[
	-- Generate the tidyVal function. If it has been specified by the user, we
	-- use that; if not, we choose one of four functions depending on the
	-- options chosen. This is so that we don't have to call the options table
	-- every time the function is called.
	--]]
	local tidyVal = options.valueFunc
	if tidyVal then
		if type(tidyVal) ~= 'function' then
			error(
				"bad value assigned to option 'valueFunc'"
					.. '(function expected, got '
					.. type(tidyVal)
					.. ')',
				2
			)
		end
	elseif options.trim ~= false then
		if options.removeBlanks ~= false then
			tidyVal = tidyValDefault
		else
			tidyVal = tidyValTrimOnly
		end
	else
		if options.removeBlanks ~= false then
			tidyVal = tidyValRemoveBlanksOnly
		else
			tidyVal = tidyValNoChange
		end
	end

	--[[
	-- Set up the args, metaArgs and nilArgs tables. args will be the one
	-- accessed from functions, and metaArgs will hold the actual arguments. Nil
	-- arguments are memoized in nilArgs, and the metatable connects all of them
	-- together.
	--]]
	local args, metaArgs, nilArgs, metatable = {}, {}, {}, {}
	setmetatable(args, metatable)

	local function mergeArgs(tables)
		--[[
		-- Accepts multiple tables as input and merges their keys and values
		-- into one table. If a value is already present it is not overwritten;
		-- tables listed earlier have precedence. We are also memoizing nil
		-- values, which can be overwritten if they are 's' (soft).
		--]]
		for _, t in ipairs(tables) do
			for key, val in pairs(t) do
				if metaArgs[key] == nil and nilArgs[key] ~= 'h' then
					local tidiedVal = tidyVal(key, val)
					if tidiedVal == nil then
						nilArgs[key] = 's'
					else
						metaArgs[key] = tidiedVal
					end
				end
			end
		end
	end

	--[[
	-- Define metatable behaviour. Arguments are memoized in the metaArgs table,
	-- and are only fetched from the argument tables once. Fetching arguments
	-- from the argument tables is the most resource-intensive step in this
	-- module, so we try and avoid it where possible. For this reason, nil
	-- arguments are also memoized, in the nilArgs table. Also, we keep a record
	-- in the metatable of when pairs and ipairs have been called, so we do not
	-- run pairs and ipairs on the argument tables more than once. We also do
	-- not run ipairs on fargs and pargs if pairs has already been run, as all
	-- the arguments will already have been copied over.
	--]]

	metatable.__index = function (t, key)
		--[[
		-- Fetches an argument when the args table is indexed. First we check
		-- to see if the value is memoized, and if not we try and fetch it from
		-- the argument tables. When we check memoization, we need to check
		-- metaArgs before nilArgs, as both can be non-nil at the same time.
		-- If the argument is not present in metaArgs, we also check whether
		-- pairs has been run yet. If pairs has already been run, we return nil.
		-- This is because all the arguments will have already been copied into
		-- metaArgs by the mergeArgs function, meaning that any other arguments
		-- must be nil.
		--]]
		if type(key) == 'string' then
			key = options.translate[key]
		end
		local val = metaArgs[key]
		if val ~= nil then
			return val
		elseif metatable.donePairs or nilArgs[key] then
			return nil
		end
		for _, argTable in ipairs(argTables) do
			local argTableVal = tidyVal(key, argTable[key])
			if argTableVal ~= nil then
				metaArgs[key] = argTableVal
				return argTableVal
			end
		end
		nilArgs[key] = 'h'
		return nil
	end

	metatable.__newindex = function (t, key, val)
		-- This function is called when a module tries to add a new value to the
		-- args table, or tries to change an existing value.
		if type(key) == 'string' then
			key = options.translate[key]
		end
		if options.readOnly then
			error(
				'could not write to argument table key "'
					.. tostring(key)
					.. '"; the table is read-only',
				2
			)
		elseif options.noOverwrite and args[key] ~= nil then
			error(
				'could not write to argument table key "'
					.. tostring(key)
					.. '"; overwriting existing arguments is not permitted',
				2
			)
		elseif val == nil then
			--[[
			-- If the argument is to be overwritten with nil, we need to erase
			-- the value in metaArgs, so that __index, __pairs and __ipairs do
			-- not use a previous existing value, if present; and we also need
			-- to memoize the nil in nilArgs, so that the value isn't looked
			-- up in the argument tables if it is accessed again.
			--]]
			metaArgs[key] = nil
			nilArgs[key] = 'h'
		else
			metaArgs[key] = val
		end
	end

	local function translatenext(invariant)
		local k, v = next(invariant.t, invariant.k)
		invariant.k = k
		if k == nil then
			return nil
		elseif type(k) ~= 'string' or not options.backtranslate then
			return k, v
		else
			local backtranslate = options.backtranslate[k]
			if backtranslate == nil then
				-- Skip this one. This is a tail call, so this won't cause stack overflow
				return translatenext(invariant)
			else
				return backtranslate, v
			end
		end
	end

	metatable.__pairs = function ()
		-- Called when pairs is run on the args table.
		if not metatable.donePairs then
			mergeArgs(argTables)
			metatable.donePairs = true
		end
		return translatenext, { t = metaArgs }
	end

	local function inext(t, i)
		-- This uses our __index metamethod
		local v = t[i + 1]
		if v ~= nil then
			return i + 1, v
		end
	end

	metatable.__ipairs = function (t)
		-- Called when ipairs is run on the args table.
		return inext, t, 0
	end

	return args
end

return arguments
见路不走是什么意思 书生是什么意思 夏季吃什么菜好 为什么我的眼里常含泪水 舌头红是什么原因
乳腺癌长在什么位置 运动裤配什么上衣好看 舌头干涩是什么病前兆 阳痿早泄是什么意思 大便粗大是什么原因
什么什么之财 甲状腺囊性结节是什么意思 月经期间喝什么好排毒排污血 枯木逢春是什么生肖 贡眉是什么茶
南极为什么比北极冷 ab型和b型生的孩子是什么血型 刚怀孕吃什么水果对胎儿好 女人右眼皮跳是什么预兆 天克地冲是什么意思
菲拉格慕属于什么档次hcv8jop2ns9r.cn 梦见雪地是什么征兆hcv8jop0ns1r.cn 铁塔公司是干什么的hcv8jop8ns1r.cn 逆时针是什么方向hcv8jop6ns3r.cn 三个又是什么字hcv7jop9ns6r.cn
b端和c端是什么意思weuuu.com 犹太人说什么语言hcv8jop8ns5r.cn 2月7号是什么星座hcv7jop6ns4r.cn 肿瘤是什么意思hcv8jop3ns6r.cn 右眼皮上长痣代表什么hcv8jop8ns5r.cn
口蘑炒什么好吃hcv9jop5ns1r.cn 草代表什么生肖hanqikai.com 胃嗳气是什么症状hcv8jop0ns4r.cn 农历7月20日是什么星座luyiluode.com 眼睛疲劳用什么眼药水helloaicloud.com
吃灵芝有什么好处hcv7jop5ns3r.cn 中午吃什么不会胖hcv9jop4ns4r.cn 大象的鼻子为什么那么长hcv9jop7ns9r.cn whatsapp是什么hcv8jop1ns6r.cn 脾胃不和吃什么药hcv8jop9ns8r.cn
百度