基围虾为什么叫基围虾| 手术后放疗起什么作用| 嬷嬷是什么意思| 燃眉之急是什么意思| 肛裂是什么原因造成的| 从革是什么意思| 6月26日什么星座| 什么水果对皮肤好祛痘| 湿热内蕴是什么意思| 粘连是什么意思| 阴对什么| 咳嗽吃什么药好得快| 新白娘子传奇许仙为什么用女的演| tia是什么病| 小狗肚子里有虫子吃什么药| 惜字如金是什么意思| 发痧是什么原因造成的| 何许人也是什么意思| 结梁子什么意思| 仓鼠吃什么东西| 胎心监护是检查什么| 麦芽糖醇是什么| 失眠用什么药最好| 早餐有什么| 人授和试管有什么区别| 枕大池增大什么意思| 湿疹为什么要查肝功能| 孀居是什么意思| 无机盐是什么| 月经下不来是什么原因| 聊胜于无什么意思| 脸颊两边长斑是什么原因| 活塞是什么意思| aigle是什么牌子| 什么样的人| s属性什么意思| 马齿苋别名叫什么| 什么是碱性食物| 上火流鼻血吃什么降火| 汉武帝是什么朝代| 宝宝大便有泡沫是什么原因| IA是什么| 老放屁是什么情况| 也字五行属什么| 1.8号是什么星座| 特斯拉用的是什么电池| 头七是什么意思| 捐肾对身体有什么影响| 肌酐激酶高是什么原因| 山茱萸的功效与作用是什么| 乳酸杆菌阳性什么意思| 为什么会打鼾| 什么是性压抑| 高血糖吃什么蔬菜| 后面的牙齿叫什么| 一什么彩虹| 阴道口痒用什么药好| 阑尾炎属于什么科室| 6d是什么意思| 冬虫夏草到底是什么| 动态心电图能检查出什么病| maxrieny是什么品牌| 披什么散什么| 肚脐右边按压疼是什么原因| 给女生送礼物送什么好| 一什么清凉| miu是什么单位| 什么的脸庞| 40年属什么| 1984年属什么生肖| 什么情况需要打破伤风| 哇哦什么意思| 布洛芬0.3和0.4g有什么区别| 副旅长是什么军衔| 槟榔是什么味道| 小姐姐是什么意思| 一月10号是什么星座| 月经太多是什么原因| 属牛的婚配什么属相最好| 额头上长痘是什么原因| 麝香保心丸治什么病| 男人蛋蛋疼是什么原因| 高血压用什么药| 人是什么生物| 人授和试管有什么区别| 苍耳是什么| aoa是什么意思| 为什么会得腱鞘炎| 庄周梦蝶是什么意思| 膝盖疼挂什么科| 什么玉最好有灵性养人| 葛根和什么搭配泡水好| 脖子落枕贴什么膏药| h2o是什么| 南通有什么大学| 地头蛇比喻什么样的人| 哺乳期吃什么水果| 男性早泄吃什么药| 青岛啤酒节是什么时候| 女人喝劲酒有什么好处| 良民是什么意思| 尿素是什么肥| 脑血管堵塞有什么症状| 宫腔镜是检查什么的| cu是什么意思| ood是什么意思| 头晕恶心想吐挂什么科| 五行大林木是什么意思| 同房出血要做什么检查| 股票尾盘拉升说明什么| 屁臭是什么原因| 五百年前是什么朝代| 艾滋病脖子有什么症状| 烂嘴角是什么原因| 助力车是什么车| 口腔溃疡是什么| 手足癣用什么药最好| 农历七月初五是什么星座| 什么是粳米| 氩气是什么气体| 嘴辰发紫是什么病| 鸡毛信是什么意思| 狗贫血吃什么补血最快| 省检察长是什么级别| 比心是什么意思| 左耳发热是什么预兆| 叶酸是什么东西| 吃什么能降低尿蛋白| poison是什么意思| 澳门什么时候回归祖国| 体检喝水了有什么影响| 什么叫台风| 猫驱虫药什么牌子好| 紫河车是什么| cro是什么职位| 尿酸高的人吃什么食物好| 5点到7点是什么时辰| 高血压用什么药最好| 夏天喝什么茶最好| 寅五行属什么| 为什么养鱼双数是大忌| 发质硬适合什么发型| 什么是梦魇| 看输卵管是否堵塞做什么检查| 躺下就头晕是什么原因| 2.7是什么星座| 考试穿什么颜色的衣服| 晚上睡觉牙齿出血是什么原因| 没事在家可以做些什么| 双子女和什么星座最配| 尿血吃什么药最好| ab和ab生的孩子是什么血型| 红和绿混合是什么颜色| 100年前是什么朝代| 琛字五行属什么| 脂肪肝喝什么茶最好最有效| 促销员是做什么的| 白开水是什么意思| 大便咖啡色什么原因| 结石不能吃什么| 所不欲勿施于人是什么意思| 风花雪月下一句是什么| 7.1什么星座| 交社保有什么用| 亦什么意思| 结膜炎是什么原因引起的| 坐月子哭了会有什么后遗症| 什么叫唐氏综合症| 冷都男是什么意思| 凹陷性疤痕用什么药膏| 什么的桃花| 阴虱用什么药最有效| 梦见自己尿裤子了是什么意思| 昵称什么意思| 管型尿是什么意思| 1984年属什么| 灰指甲看什么科| 腰间盘突出挂什么科室| 金刚藤有什么功效| 米老鼠叫什么名字| 送护士女朋友什么礼物| 藏语扎西德勒是什么意思| 酸碱度偏低是什么原因| 妈妈姐姐的女儿叫什么| ldh是什么| 血小板计数是什么意思| 4月20日是什么星座| 杨梅不能和什么一起吃| 善太息是什么意思| 为什么很多人不去庐山| 异地办理临时身份证需要什么材料| 下眼袋大是什么原因引起的| 雀舌属于什么茶| 什么不见| 什么鱼适合清蒸| 什么叫轻度脂肪肝| 蜂王浆是什么味道| 膝盖酸是什么原因| 三叉神经吃什么药好| 世界大同是什么意思| 姜子牙为什么没有封神| 右边锁骨疼是什么原因| 1978年属马五行属什么| 孤独症有什么表现| 表示什么意思| 安字属于五行属什么| 有且仅有什么意思| 一什么杏子| 吃什么可以解酒最快简单| 肉蒲团是什么意思| 交界性心律是什么意思| 小腿肿胀是什么原因| 女人抖腿代表什么意思| 婊子是什么| 简单是什么意思| absolue是兰蔻的什么产品| 胃糜烂是什么原因引起的| 耳朵烫是什么原因| neu是什么意思| 什么通便效果最快最好| 牙周炎是什么症状| 女人吃什么排湿气最快| 什么叫脑梗| 回族信奉什么教| 一直流鼻血是什么原因| 月经量减少是什么原因| 鸡奸是什么意思| 全身皮肤瘙痒是什么原因引起的| 勇者胜的上半句是什么| 大腿根部内侧瘙痒用什么药膏| 孩子鼻子出血什么原因造成的| 女人每天喝什么最养颜| 1998年属虎的是什么命| 燥湿是什么意思| 扁桃体发炎不能吃什么东西| 胸膜炎吃什么药好| 知己什么意思| 别人梦见我死了是什么意思| 血细胞分析五分类是查什么的| 7.14什么情人节| nbi是什么意思| 肌酐高吃什么中药| 11月11是什么星座| 分分钟都妙不可言是什么歌| 李连杰什么病| 胡萝卜不能和什么食物一起吃| 锁骨上有痣代表什么| 南方有什么生肖| 护照是什么意思| 鸡蛋和面粉可以做什么好吃的| 锋芒毕露是什么意思| 可可尼女装什么档次| 三尖瓣关闭不全是什么意思| 尿胆原是什么| 不爱说话的人是什么性格| 魅可口红属于什么档次| 北京的市花是什么| 什么时候洗头是最佳时间| 膝盖不舒服挂什么科| 229什么星座| 做鸡蛋饼用什么面粉好| 生男孩女孩取决于什么| 糖尿病吃什么水果| 妥瑞氏症是什么病| 百度Edukira joan

车讯:2017年推全新紧凑型SUV 曝奇瑞新车计划

Wikipedia, Entziklopedia askea
百度 王安石是有名的拗相公,司马光就新法与其争论时,说王安石性不晓事而复执拗,司马光在信中指责王安石用心太过,自信太厚,直欲求非常之功,而忽常人之所知。

Documentation for this module may be created at Modulu:TableTools/dok

--[[
------------------------------------------------------------------------------------
--                               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
肝肿大是什么原因 什么是三界五行 做梦牙齿掉了是什么预兆 骨加客念什么 与狼共舞什么意思
ala是什么氨基酸 常喝枸杞泡水有什么好处 2是什么意思 什么是abo文 苏州有什么特产可以带回家
汝字五行属什么 桑树枝煮水有什么功效 孙武和孙膑是什么关系 十月八号是什么星座 什么算高危性行为
四月二十五是什么星座 来月经是黑色的是什么原因 代孕是什么 女人梦见搬家预示什么 黄芪什么人不能喝
毛囊炎是什么症状beikeqingting.com 什么长什么去hcv8jop8ns0r.cn 奴役是什么意思hcv8jop1ns0r.cn 割包皮有什么好处和坏处hcv9jop0ns4r.cn 前降支中段心肌桥什么意思hcv9jop0ns4r.cn
干咳挂什么科hcv9jop2ns3r.cn ccu病房是什么意思hcv9jop5ns7r.cn 两颗星是什么军衔hcv9jop5ns9r.cn 射手座最配什么星座gysmod.com 拔牙后可以吃什么食物hcv8jop0ns1r.cn
牙周炎挂什么科hcv8jop4ns7r.cn 什么人不能吃西洋参hcv8jop5ns1r.cn 后巩膜葡萄肿是什么意思naasee.com 总是出汗是什么原因hcv8jop4ns0r.cn 尿隐血挂什么科hcv8jop5ns7r.cn
上皮细胞高是什么原因hcv9jop5ns3r.cn 小儿割包皮挂什么科hcv9jop5ns6r.cn 什么病会引起腰疼hcv9jop5ns3r.cn hpv45型阳性是什么意思hcv8jop8ns9r.cn 拔罐有什么用hcv8jop6ns5r.cn
百度