双肾钙化灶是什么意思| 甘油三脂高是什么意思| 心有余而力不足什么意思| 头痛到医院挂什么科| 闭角型青光眼是什么意思| ra是什么意思| 作陪是什么意思| 什么盐好| 叶黄素对眼睛有什么功效| 花园里有什么花| 大便干结吃什么药| 多囊不能吃什么食物| 尿常规红细胞高是什么原因| 我国四大发明是什么| 歇菜是什么意思| 肺炎后遗症有什么症状| as什么意思| 两肺纹理增粗是什么意思| 香膏是什么| 蝙蝠吃什么| 什么的摇篮| 天字加一笔是什么字| 换床有什么讲究| 梦见游泳是什么预兆| 咳黄痰吃什么药好得快| 头晕视力模糊是什么原因| 肠道感染吃什么消炎药| 日前是什么意思| 狼爪是什么牌子| 近视用什么镜矫正| 为什么歌曲| 颈椎病最怕干什么活| 局部癌变是什么意思| 白痰咳嗽用什么药最好| 2006年属什么生肖| 左边头疼是什么原因| 什么拉车连蹦带跳| 吃什么可以调理肠胃| 什么是陈述句| 茶学专业学什么| 什么是http| 什么是变异性哮喘| 爱情是什么样子的| 猪油吃多了有什么好处和坏处| 十一月二十二是什么星座| 妇科杆菌是什么引起的| 夜开花是什么菜| 什么案件才会出动便衣| 亦如是什么意思| 7.1是什么日子| 孕妇为什么要躲着白事| 肿瘤切开了里面是什么| 肝脏低回声意味着什么| 什么是胰腺| smz是什么药| 男人都喜欢什么样的女人| 6月30号什么星座| 铁蛋白是什么意思| 四菜一汤是什么意思| 低血糖吃什么食物| 一什么瀑布| 吃什么增加免疫力最快| 什么符号| 吃番茄有什么好处| 湿疹抹什么药| ber是什么意思| 正比和反比是什么意思| 脚趾抽筋是什么原因| 晓五行属什么| 阑尾炎吃什么药| vibe什么意思| 嘴唇发麻是什么原因| 为什么会长粉刺| 尿路感染是什么原因造成的| 南昌有什么好玩的| 肩膀上有痣代表什么| 为什么会长溃疡| 颓废是什么意思| 鼻子出油多是什么原因| 狗代表什么数字| 胃痛是什么原因| 血压低吃什么能补上来| 脑委缩有什么症状| 爱发朋友圈的女人是什么心态| 胃反酸吃什么| 认真地什么| 学子是什么意思| 三月阳春好风光是什么生肖| 附子是什么| 蹉跎是什么意思| 什么是化合物| 行气是什么意思| 有什么好吃的零食| 万金油是什么意思| 心灵鸡汤什么意思| 哮喘吃什么药好| 狗到家里是什么预兆| 什么是肾阴虚| hpv什么意思| 脉数是什么意思| 奥氮平片是什么药| 女人外阴瘙痒用什么药| 故步自封是什么意思| 什么是标准预防| 爸爸的姐夫叫什么| 大连六院是什么医院| 不完全性右束支传导阻滞是什么意思| 99朵玫瑰花代表什么| 泡泡是什么意思| 马步鱼为什么是甜的| 产后恶露是什么| 胃胀吃什么药效果最好| 为什么体重一直下降| 垂问是什么意思| 后脑勺出汗多是什么原因| 胆管堵塞有什么症状| 宫腔线不清晰什么意思| 灼热是什么意思| 鳄鱼属于什么动物| 看痔疮挂什么科| 调御丈夫是什么意思| 血糖忽高忽低是什么原因| 砸是什么意思| 枸杞泡酒有什么作用和功效| 血药浓度是什么意思| 氮肥是什么肥| 颌下淋巴结肿大挂什么科| 梦见杀人了是什么意思| 慌张是什么意思| 9月10号什么星座| 梦见黄狗是什么意思| visa是什么| 磁共振是做什么的| 什么是滑膜炎| 花生不能和什么食物一起吃| 花椒有什么功效| 吃什么药可以推迟月经| 儿童腮腺炎吃什么药| 飘了是什么意思| 疯狂动物城树懒叫什么| 五毛是什么意思| 露酒是什么意思| 拉肚子吃什么菜| 宽粉是什么做的| 打哈欠为什么会传染| 甲状腺球蛋白抗体高是什么意思| 小肚子疼挂什么科| 炸薯条用什么淀粉| 恋是什么意思| 结石是什么原因引起的| 小孩眼屎多是什么原因引起的| 手为什么会抖| 宜家宜室什么意思| 类风湿性关节炎吃什么药| 老火是什么意思| 西洋菜俗称叫什么| 广州有什么美食| 嬷嬷什么意思| 高血压挂号要挂什么科| 水猴子是什么动物| 竹笋炒什么好吃| 前列腺钙化有什么症状| 唇炎用什么药| 零零年属什么| 莲是什么结构的字| 泰迪吃什么| 子宫肌瘤吃什么| 一进门见到什么植物好| 今天是什么冲什么生肖| 药流没流干净有什么症状| 月经期喝什么水最好| 经常打嗝是什么原因| 126是什么邮箱| 枣什么时候成熟| 手心发热吃什么药最好| 桑葚干和什么搭配泡水| 喝咖啡有什么好处和坏处| 先天性心脏病是什么原因造成的| 电器火灾用什么灭火器| 手痒脱皮是什么原因| 长辈生日送什么花| hbeag是什么意思| 视力sca分别代表什么| 长宽高用什么字母表示| 老年人腿脚无力是什么原因| 什么是公共场所| lop是什么意思| 抬头纹开了是什么意思| 并发是什么意思| 蛊虫是什么| 心脏骤停是什么原因引起的| 王加玉念什么| 梦见白萝卜是什么意思| 乙肝e抗原阳性是什么意思| 川普是什么意思| 总胆红素是什么意思| 鼻子流血是什么原因| 嘚儿是什么意思| 孩子经常流鼻血是什么原因| 铁扇公主是什么生肖| 化疗后恶心呕吐吃什么可以缓解| cm和mm有什么区别| 新生儿头发稀少是什么原因| 孕反应最早什么时候开始| 蝴蝶吃什么食物| 文书是什么意思| 二级烫伤是什么程度| 什么言什么色| 前列腺用什么药| 小便尿血是什么原因| 下架是什么意思| 贴士是什么意思| 检察院是做什么的| 为什么会血热| 上吐下泻是什么原因| 大姨妈来能吃什么水果| 青蛙属于什么类动物| 老板喜欢什么样的员工| 为什么要分手| 胃溃疡是什么症状| 液化是什么意思| 扁桃体结石有什么危害| 二便是什么意思| 甲虫吃什么| 大腿内侧疼痛什么原因| 尬是什么意思| 松针泡水喝有什么功效| 非无菌是什么意思| 无常是什么意思| 提前来大姨妈是什么原因| 宫颈管分离是什么意思| 阿司匹林不能和什么药一起吃| 艾灸后痒是什么原因| 同房后小腹疼痛是什么原因| 经常低血糖是什么原因| 芭乐是什么水果| 1968属什么| 薛字五行属什么| 春天像什么的比喻句| 前列腺增生吃什么药| 财位在什么方位| 庚子是什么意思| 雅字取名的寓意是什么| 孕妇贫血对胎儿有什么影响| 双一流大学是什么| 淋巴发炎挂什么科| 宝妈男是什么意思| 扦脚是什么意思| rh血型阳性什么意思| 为什么会长寻常疣| 梦见被鱼咬是什么意思| 为什么微信运动总是显示步数为0| 阴茎溃疡用什么药| 破太岁是什么意思| 玫瑰和月季有什么区别| 巧囊是什么原因形成的| 男的尿血是什么原因| 煮中药用什么锅| 什么东西解腻| cns医学上是什么意思| 结甲是什么意思| 腰椎间盘突出不能吃什么食物| 牛肉炖什么| 河蚌为什么没人吃| 百度Содержанийышке куснаш

人大周赞主任带领区四套班子领导一行新春走访

Ир?к?н энциклопеди Википеди г?ц материал
百度 老公在外地做生意,公公婆婆也没退休,爸妈太远更帮不上忙,一胎从头到尾都是我一个人,已经没有什么个人的时间和空间了。

Для документации этого модуля может быть создана страница Модуль:TableTools/doc

--[[
------------------------------------------------------------------------------------
--                               TableTools                                       --
--                                                                                --
-- This module includes a number of functions for dealing with Lua tables.        --
-- It is a meta-module, meant to be called from other Lua modules, and should     --
-- not be called directly from #invoke.                                           --
------------------------------------------------------------------------------------
--]]

local libraryUtil = require('libraryUtil')

local p = {}

-- Define often-used variables and functions.
local floor = math.floor
local infinity = math.huge
local checkType = libraryUtil.checkType
local checkTypeMulti = libraryUtil.checkTypeMulti

--[[
------------------------------------------------------------------------------------
-- isPositiveInteger
--
-- This function returns true if the given value is a positive integer, and false
-- if not. Although it doesn't operate on tables, it is included here as it is
-- useful for determining whether a given table key is in the array part or the
-- hash part of a table.
------------------------------------------------------------------------------------
--]]
function p.isPositiveInteger(v)
	if type(v) == 'number' and v >= 1 and floor(v) == v and v < infinity then
		return true
	else
		return false
	end
end

--[[
------------------------------------------------------------------------------------
-- isNan
--
-- This function returns true if the given number is a NaN value, and false
-- if not. Although it doesn't operate on tables, it is included here as it is
-- useful for determining whether a value can be a valid table key. Lua will
-- generate an error if a NaN is used as a table key.
------------------------------------------------------------------------------------
--]]
function p.isNan(v)
	if type(v) == 'number' and tostring(v) == '-nan' then
		return true
	else
		return false
	end
end

--[[
------------------------------------------------------------------------------------
-- shallowClone
--
-- This returns a clone of a table. The value returned is a new table, but all
-- subtables and functions are shared. Metamethods are respected, but the returned
-- table will have no metatable of its own.
------------------------------------------------------------------------------------
--]]
function p.shallowClone(t)
	local ret = {}
	for k, v in pairs(t) do
		ret[k] = v
	end
	return ret
end

--[[
------------------------------------------------------------------------------------
-- removeDuplicates
--
-- This removes duplicate values from an array. Non-positive-integer keys are
-- ignored. The earliest value is kept, and all subsequent duplicate values are
-- removed, but otherwise the array order is unchanged.
------------------------------------------------------------------------------------
--]]
function p.removeDuplicates(t)
	checkType('removeDuplicates', 1, t, 'table')
	local isNan = p.isNan
	local ret, exists = {}, {}
	for i, v in ipairs(t) do
		if isNan(v) then
			-- NaNs can't be table keys, and they are also unique, so we don't need to check existence.
			ret[#ret + 1] = v
		else
			if not exists[v] then
				ret[#ret + 1] = v
				exists[v] = true
			end
		end	
	end
	return ret
end			

--[[
------------------------------------------------------------------------------------
-- numKeys
--
-- This takes a table and returns an array containing the numbers of any numerical
-- keys that have non-nil values, sorted in numerical order.
------------------------------------------------------------------------------------
--]]
function p.numKeys(t)
	checkType('numKeys', 1, t, 'table')
	local isPositiveInteger = p.isPositiveInteger
	local nums = {}
	for k, v in pairs(t) do
		if isPositiveInteger(k) then
			nums[#nums + 1] = k
		end
	end
	table.sort(nums)
	return nums
end

--[[
------------------------------------------------------------------------------------
-- affixNums
--
-- This takes a table and returns an array containing the numbers of keys with the
-- specified prefix and suffix. For example, for the table
-- {a1 = 'foo', a3 = 'bar', a6 = 'baz'} and the prefix "a", affixNums will
-- return {1, 3, 6}.
------------------------------------------------------------------------------------
--]]
function p.affixNums(t, prefix, suffix)
	checkType('affixNums', 1, t, 'table')
	checkType('affixNums', 2, prefix, 'string', true)
	checkType('affixNums', 3, suffix, 'string', true)

	local function cleanPattern(s)
		-- Cleans a pattern so that the magic characters ()%.[]*+-?^$ are interpreted literally.
		s = s:gsub('([%(%)%%%.%[%]%*%+%-%?%^%$])', '%%%1')
		return s
	end

	prefix = prefix or ''
	suffix = suffix or ''
	prefix = cleanPattern(prefix)
	suffix = cleanPattern(suffix)
	local pattern = '^' .. prefix .. '([1-9]%d*)' .. suffix .. '$'

	local nums = {}
	for k, v in pairs(t) do
		if type(k) == 'string' then			
			local num = mw.ustring.match(k, pattern)
			if num then
				nums[#nums + 1] = tonumber(num)
			end
		end
	end
	table.sort(nums)
	return nums
end

--[[
------------------------------------------------------------------------------------
-- numData
--
-- Given a table with keys like ("foo1", "bar1", "foo2", "baz2"), returns a table
-- of subtables in the format 
-- { [1] = {foo = 'text', bar = 'text'}, [2] = {foo = 'text', baz = 'text'} }
-- Keys that don't end with an integer are stored in a subtable named "other".
-- The compress option compresses the table so that it can be iterated over with
-- ipairs.
------------------------------------------------------------------------------------
--]]
function p.numData(t, compress)
	checkType('numData', 1, t, 'table')
	checkType('numData', 2, compress, 'boolean', true)
	local ret = {}
	for k, v in pairs(t) do
		local prefix, num = mw.ustring.match(tostring(k), '^([^0-9]*)([1-9][0-9]*)$')
		if num then
			num = tonumber(num)
			local subtable = ret[num] or {}
			if prefix == '' then
				-- Positional parameters match the blank string; put them at the start of the subtable instead.
				prefix = 1
			end
			subtable[prefix] = v
			ret[num] = subtable
		else
			local subtable = ret.other or {}
			subtable[k] = v
			ret.other = subtable
		end
	end
	if compress then
		local other = ret.other
		ret = p.compressSparseArray(ret)
		ret.other = other
	end
	return ret
end

--[[
------------------------------------------------------------------------------------
-- compressSparseArray
--
-- This takes an array with one or more nil values, and removes the nil values
-- while preserving the order, so that the array can be safely traversed with
-- ipairs.
------------------------------------------------------------------------------------
--]]
function p.compressSparseArray(t)
	checkType('compressSparseArray', 1, t, 'table')
	local ret = {}
	local nums = p.numKeys(t)
	for _, num in ipairs(nums) do
		ret[#ret + 1] = t[num]
	end
	return ret
end

--[[
------------------------------------------------------------------------------------
-- sparseIpairs
--
-- This is an iterator for sparse arrays. It can be used like ipairs, but can
-- handle nil values.
------------------------------------------------------------------------------------
--]]
function p.sparseIpairs(t)
	checkType('sparseIpairs', 1, t, 'table')
	local nums = p.numKeys(t)
	local i = 0
	local lim = #nums
	return function ()
		i = i + 1
		if i <= lim then
			local key = nums[i]
			return key, t[key]
		else
			return nil, nil
		end
	end
end

--[[
------------------------------------------------------------------------------------
-- size
--
-- This returns the size of a key/value pair table. It will also work on arrays,
-- but for arrays it is more efficient to use the # operator.
------------------------------------------------------------------------------------
--]]

function p.size(t)
	checkType('size', 1, t, 'table')
	local i = 0
	for k in pairs(t) do
		i = i + 1
	end
	return i
end


local function defaultKeySort(item1, item2)
	-- "number" < "string", so numbers will be sorted before strings.
	local type1, type2 = type(item1), type(item2)
	if type1 ~= type2 then
		return type1 < type2
	else -- This will fail with table, boolean, function.
		return item1 < item2
	end
end

--[[
	Returns a list of the keys in a table, sorted using either a default
	comparison function or a custom keySort function.
]]
function p.keysToList(t, keySort, checked)
	if not checked then
		checkType('keysToList', 1, t, 'table')
		checkTypeMulti('keysToList', 2, keySort, { 'function', 'boolean', 'nil' })
	end
	
	local list = {}
	local index = 1
	for key, value in pairs(t) do
		list[index] = key
		index = index + 1
	end
	
	if keySort ~= false then
		keySort = type(keySort) == 'function' and keySort or defaultKeySort
		
		table.sort(list, keySort)
	end
	
	return list
end

--[[
	Iterates through a table, with the keys sorted using the keysToList function.
	If there are only numerical keys, sparseIpairs is probably more efficient.
]]
function p.sortedPairs(t, keySort)
	checkType('sortedPairs', 1, t, 'table')
	checkType('sortedPairs', 2, keySort, 'function', true)
	
	local list = p.keysToList(t, keySort, true)
	
	local i = 0
	return function()
		i = i + 1
		local key = list[i]
		if key ~= nil then
			return key, t[key]
		else
			return nil, nil
		end
	end
end

--[[
	Returns true if all keys in the table are consecutive integers starting at 1.
--]]
function p.isArray(t)
	checkType("isArray", 1, t, "table")
	
	local i = 0
	for k, v in pairs(t) do
		i = i + 1
		if t[i] == nil then
			return false
		end
	end
	return true
end

-- { "a", "b", "c" } -> { a = 1, b = 2, c = 3 }
function p.invert(array)
	checkType("invert", 1, array, "table")
	
	local map = {}
	for i, v in ipairs(array) do
		map[v] = i
	end
	
	return map
end

--[[
	{ "a", "b", "c" } -> { ["a"] = true, ["b"] = true, ["c"] = true }
--]]
function p.listToSet(t)
	checkType("listToSet", 1, t, "table")
	
	local set = {}
	for _, item in ipairs(t) do
		set[item] = true
	end
	
	return set
end

--[[
	Recursive deep copy function.
	Preserves identities of subtables.
	
]]
local function _deepCopy(orig, includeMetatable, already_seen)
	-- Stores copies of tables indexed by the original table.
	already_seen = already_seen or {}
	
	local copy = already_seen[orig]
	if copy ~= nil then
		return copy
	end
	
	if type(orig) == 'table' then
		copy = {}
		for orig_key, orig_value in pairs(orig) do
			copy[deepcopy(orig_key, includeMetatable, already_seen)] = deepcopy(orig_value, includeMetatable, already_seen)
		end
		already_seen[orig] = copy
		
		if includeMetatable then
			local mt = getmetatable(orig)
			if mt ~= nil then
				local mt_copy = deepcopy(mt, includeMetatable, already_seen)
				setmetatable(copy, mt_copy)
				already_seen[mt] = mt_copy
			end
		end
	else -- number, string, boolean, etc
		copy = orig
	end
	return copy
end

function p.deepCopy(orig, noMetatable, already_seen)
	checkType("deepCopy", 3, already_seen, "table", true)
	
	return _deepCopy(orig, not noMetatable, already_seen)
end

--[[
	Concatenates all values in the table that are indexed by a number, in order.
	sparseConcat{ a, nil, c, d }  =>  "acd"
	sparseConcat{ nil, b, c, d }  =>  "bcd"
]]
function p.sparseConcat(t, sep, i, j)
	local list = {}
	
	local list_i = 0
	for _, v in p.sparseIpairs(t) do
		list_i = list_i + 1
		list[list_i] = v
	end
	
	return table.concat(list, sep, i, j)
end

--[[
-- This returns the length of a table, or the first integer key n counting from
-- 1 such that t[n + 1] is nil. It is similar to the operator #, but may return
-- a different value when there are gaps in the array portion of the table.
-- Intended to be used on data loaded with mw.loadData. For other tables, use #.
-- Note: #frame.args in frame object always be set to 0, regardless of 
-- the number of unnamed template parameters, so use this function for
-- frame.args.
--]]
function p.length(t)
	local i = 1
	while t[i] ~= nil do
		i = i + 1
	end
	return i - 1
end

function p.inArray(arr, valueToFind)
	checkType("inArray", 1, arr, "table")
	
	-- if valueToFind is nil, error?
	
	for _, v in ipairs(arr) do
		if v == valueToFind then
			return true
		end
	end
	
	return false
end

return p
拔胡子有什么危害 胃酸胃烧心吃什么药 一什么雪花 酸豆角炒什么好吃 脸浮肿是什么病的前兆
症候群什么意思 胎儿永存左上腔静脉是什么意思 鸡口牛后是什么生肖 樱桃不能和什么一起吃 胎毒是什么意思
pg在医学是什么意思 球蛋白偏低是什么意思 情形是什么意思 肝纤维化是什么意思 衬衫配什么裤子好看
干冰是什么 肉麻是什么意思 凌空什么 红色的海鱼是什么鱼 胆结石是什么原因造成的
狐臭用什么药最好hcv9jop4ns8r.cn 华为最新款手机是什么型号hcv8jop6ns2r.cn 村书记是什么级别hcv9jop2ns2r.cn 老年痴呆症挂什么科hcv8jop1ns3r.cn 生姜什么时候种hcv7jop7ns1r.cn
生理年龄是什么意思hcv8jop8ns6r.cn 辣椒炒肉用什么肉hcv8jop6ns2r.cn 孕妇地中海贫血对胎儿有什么影响adwl56.com 波奇饭是什么意思hcv9jop0ns4r.cn 牙齿挂什么科hcv8jop7ns5r.cn
难为你了是什么意思huizhijixie.com 肛裂是什么hcv9jop7ns4r.cn 办理生育津贴需要什么资料hcv8jop2ns2r.cn 禅修是什么意思hcv8jop3ns2r.cn 突然间头晕是什么原因hcv8jop8ns9r.cn
脚气用什么hcv8jop7ns1r.cn 天煞孤星是什么意思hcv8jop6ns1r.cn 滑肠是什么意思hcv7jop5ns5r.cn 女人喝什么茶叶最好hcv8jop1ns6r.cn 止痛片吃多了有什么副作用hcv8jop8ns9r.cn
百度