蛋白尿是什么意思| 增强胃动力吃什么药| 什么动物睡觉不闭眼睛| 落地签是什么意思| 晚上睡不着觉吃什么药| 在野是什么意思| 红曲红是什么东西| 燕子每年从什么方飞往什么方过冬| 蓝姓是什么民族| 三八线是什么意思| 死了妻子的男人叫什么| 嗓子沙哑吃什么药| 五光十色是什么生肖| 按摩spa是什么意思| 梦见自行车是什么意思| 替拉依是什么药| 坐享其成是什么意思| 结局be是什么意思| 大宗物品是什么意思| 口腔溃疡是缺什么维生素| 国务院秘书长什么级别| 心脏早搏有什么症状| 口气重吃什么药效果好| 1989属什么| 真菌感染脚气用什么药| 脸颊两边长痘痘是什么原因引起的| ug是什么单位| 人生只剩归途什么意思| 陕西为什么叫三秦大地| 细菌性阴道炎用什么药效果好| 为什么会尿路感染| 松香有毒吗对人体有什么危害| 上炕是什么意思| 记忆力不好吃什么| 每天吃黄瓜有什么好处| 收获颇丰什么意思| 什么效应| 梦见头发白了是什么意思| 微信附近的人都是些什么人| 甲状腺结节什么引起的| 为什么万恶淫为首| 为什么越睡越困| 腰椎ct能查出什么| 电动车是什么电池| 黄痰吃什么药| 幽默什么意思| 259是什么意思| 经常掉头发是什么原因| 内膜薄是什么原因| 鳞状上皮内高度病变是什么意思| 乙肝15阳性是什么意思| 次数是什么| 水猴子长什么样子| 女人眉毛稀少代表什么| 歧途什么意思| dna由什么组成| 肚脐两边疼是什么原因| 十年大运是什么意思| 吃海参有什么好处| 有利有弊是什么意思| 1988是什么年| 区武装部部长是什么级别| 三氯蔗糖是什么东西| 血糖高是什么症状| 经常晕倒是什么原因引起的| 什么水果降火| 刺史是什么官职| 什么的梨子| 佛珠断了有什么预兆| 什么最赚钱| 为什么手淫很快就射| 氨气是什么| 化验痰可以检查出什么| 樵夫是什么意思| 脾大是什么原因造成的| 膀胱炎看什么科| 倒立有什么好处和坏处| 绝经三年了突然又出血了什么原因| 猪展是什么| 右侧疼痛是什么原因| 卡码是什么意思| 特别容易饿是什么原因| 金银花泡水喝有什么好处| ncf什么意思| 见龙在田什么意思| 别开生面什么意思| 什么游戏最赚钱| 89年的属什么| 野生天麻长什么样图片| 孕妇心情不好对胎儿有什么影响| 中耳炎去药店买什么药| 理气是什么意思| 梦到妈妈怀孕什么预兆| 无缘是什么意思| 补气吃什么好| 甲亢适合吃什么食物| 月经没来吃什么药可以催月经来| 口苦是什么原因引起的| 小酌怡情什么意思| 人湿气重有什么症状| 白细胞低吃什么食物好| 老年人便秘吃什么药| 陕西为什么叫三秦大地| 博文是什么意思| 749局是什么| 奥美拉唑治什么病| 夷是什么意思| 1943年属什么生肖| 月经量多是什么原因引起的| 月经后一周又出血是什么原因| 西梅什么时候成熟| 皮肤越抓越痒是什么原因| 榴莲壳有什么作用| 烛光晚餐是什么意思| 双脚踝浮肿是什么原因| 口干口苦是什么病| 昂热为什么认识路鸣泽| 打完耳洞不能吃什么| 肝功能2项是指什么| 老年人贫血吃什么补血最快最有效| 辣的部首是什么| 生死有命富贵在天什么意思| 报销凭证是什么| 高密度脂蛋白胆固醇偏高是什么意思| 小孩抽动症是什么引起的| 一路繁花的意思是什么| 说什么好| 夜尿多是什么原因引起的| 吃紫菜有什么好处和坏处| 中午吃什么不会胖| 什么是碳水化合物| 尿胆原高是什么原因| 嗓子疼喝什么饮料| 胎儿肠管扩张是什么原因造成的| 驻马店古代叫什么| 脸色苍白没有血色是什么原因| 静脉曲张看什么科室| 朱元璋代表什么生肖| 基础代谢是什么意思| hi什么意思| 猫咪弓背是什么原因| 千什么一发| 三八线是什么意思| 封建迷信是什么| 孕前检查什么时候去最合适| 莲子有什么作用| 尿蛋白阴性是什么意思| 什么茶叶降血压最好| 维酶素片搭配什么药治萎缩性胃炎| below是什么意思| 低钾血症是什么意思| 属马的本命佛是什么佛| 喝什么助眠| 行运是什么意思| 通草和什么炖最催奶了| 褶子是什么意思| 7.11是什么星座| 开车压到蛇有什么说法| 迅雷不及掩耳之势是什么意思| 什么季节| 玉米的种子是什么| 鱼油什么时候吃| 脂蛋白a高吃什么能降下来| 慢性咽喉炎吃什么药好| 口是心非是什么意思| 螺旋杆菌阳性是什么病| 黑眼圈挂什么科| 左心室舒张功能减退是什么意思| 舌头发黑是什么原因| 裂隙灯能查出什么眼病| 糖类抗原125偏高是什么原因| 肚子怕冷是什么原因该怎么办| 脑炎是什么症状| 头昏脑胀是什么原因| 花是什么生肖| 左肺纤维灶什么意思| 腰间盘挂什么科| zorro是什么牌子的打火机| 蛋白质高是什么原因| 女性体寒 吃什么好| 鸡同鸭讲是什么意思| 黄牌车是什么意思| 迪奥是什么意思| 松花粉对肝有什么好处| 马蹄粉是什么粉| zoom什么意思| 什么的衣裳| 牛肉丸子配什么菜好吃| 二月初二是什么星座| 脑白质疏松是什么意思| 龋齿和蛀牙有什么区别| feat什么意思| 333是什么意思| 白垩纪是什么意思| 灵媒是什么意思| 一次不忠终身不用什么意思| 内什么外什么| 心电图电轴右偏是什么意思| 伯爵是什么意思| 梦见小女孩是什么预兆| 牙龈发炎是什么原因引起的| 摩羯座是什么象| 依巴斯汀片是什么药| 为什么会吐血| 窝窝头是用什么做的| 吃榴莲对女人有什么好处| 麦冬有什么功效| 跳空缺口是什么意思| 牙龈无缘无故出血是什么原因| 舅舅是什么关系| 两个土念什么| 什么邮箱最好用最安全| 无性婚姻会有什么好处| 降压灵又叫什么| 童心未泯是什么意思| 什么是处男| 化疗有什么副作用| 一如既往什么意思| 冲猴煞北是什么意思| 吃什么有助于骨头愈合| 脱发缺少什么维生素| 左侧肚脐旁边疼是什么原因| 牙结石不除有什么危害| 吃三七粉有什么作用| 快穿是什么意思| 左脚麻是什么原因| 属虎的和什么属相最配| 气血不足吃什么好食补| 菜板什么木材最好| 小沈阳名字叫什么| 95年属什么生肖婚配表| 花生吃多了有什么坏处| 张牙舞爪的张是什么意思| 定点医院什么意思| 什么是理数| 井里面一个点念什么| 疳积是什么病| 基础代谢率是什么意思| 夏天能干什么| 绿色加什么颜色是蓝色| 7月23日是什么日子| 疮疖是什么意思| 性格好是什么意思| 经常偏头疼是什么原因| 幺是什么意思| 什么时候喝牛奶效果最佳| 月经有点黑是什么原因| 泄泻病是什么意思| 三班倒是什么意思| 什么叫suv车| 事宜是什么意思| 有什么好看的国漫| gmv是什么意思| 去医院看舌头挂什么科| 脚趾甲变厚是什么原因| 法国铁塔叫什么名字| 半梦半醒是什么意思| 龙猫是什么动物| 114514什么意思| 七八年属什么生肖| 什么是补铁的食物| 皇协军是什么意思| 高锰酸钾是什么| 脸上起红疙瘩是什么原因| 百度Jump to content

车讯:售162.8万元起 2017款日产GT-R国内上市

???????? ??????????????? ??????????????????????? ???????

------------------------------------------------------------------------------------
--                                   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)
	return type(v) == 'number' and v >= 1 and floor(v) == v and v < infinity
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)
	return type(v) == 'number' and v ~= v
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)
	checkType('shallowClone', 1, t, 'table')
	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(arr)
	checkType('removeDuplicates', 1, arr, 'table')
	local isNan = p.isNan
	local ret, exists = {}, {}
	for _, v in ipairs(arr) 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
		elseif not exists[v] then
			ret[#ret + 1] = v
			exists[v] = true
		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 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.
		return s:gsub('([%(%)%%%.%[%]%*%+%-%?%^%$])', '%%%1')
	end

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

	local nums = {}
	for k 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 _ 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
	elseif type1 == 'table' or type1 == 'boolean' or type1 == 'function' then
		return tostring(item1) < tostring(item2)
	else
		return item1 < item2
	end
end
------------------------------------------------------------------------------------
-- keysToList
--
-- Returns an array 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 arr = {}
	local index = 1
	for k in pairs(t) do
		arr[index] = k
		index = index + 1
	end

	if keySort ~= false then
		keySort = type(keySort) == 'function' and keySort or defaultKeySort
		table.sort(arr, keySort)
	end

	return arr
end

------------------------------------------------------------------------------------
-- sortedPairs
--
-- 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 arr = p.keysToList(t, keySort, true)

	local i = 0
	return function ()
		i = i + 1
		local key = arr[i]
		if key ~= nil then
			return key, t[key]
		else
			return nil, nil
		end
	end
end

------------------------------------------------------------------------------------
-- isArray
--
-- Returns true if the given value is a table and all keys are consecutive
-- integers starting at 1.
------------------------------------------------------------------------------------
function p.isArray(v)
	if type(v) ~= 'table' then
		return false
	end
	local i = 0
	for _ in pairs(v) do
		i = i + 1
		if v[i] == nil then
			return false
		end
	end
	return true
end

------------------------------------------------------------------------------------
-- isArrayLike
--
-- Returns true if the given value is iterable and all keys are consecutive
-- integers starting at 1.
------------------------------------------------------------------------------------
function p.isArrayLike(v)
	if not pcall(pairs, v) then
		return false
	end
	local i = 0
	for _ in pairs(v) do
		i = i + 1
		if v[i] == nil then
			return false
		end
	end
	return true
end

------------------------------------------------------------------------------------
-- invert
--
-- Transposes the keys and values in an array. For example, {"a", "b", "c"} ->
-- {a = 1, b = 2, c = 3}. Duplicates are not supported (result values refer to
-- the index of the last duplicate) and NaN values are ignored.
------------------------------------------------------------------------------------
function p.invert(arr)
	checkType("invert", 1, arr, "table")
	local isNan = p.isNan
	local map = {}
	for i, v in ipairs(arr) do
		if not isNan(v) then
			map[v] = i
		end
	end

	return map
end

------------------------------------------------------------------------------------
-- listToSet
--
-- Creates a set from the array part of the table. Indexing the set by any of the
-- values of the array returns true. For example, {"a", "b", "c"} ->
-- {a = true, b = true, c = true}. NaN values are ignored as Lua considers them
-- never equal to any value (including other NaNs or even themselves).
------------------------------------------------------------------------------------
function p.listToSet(arr)
	checkType("listToSet", 1, arr, "table")
	local isNan = p.isNan
	local set = {}
	for _, v in ipairs(arr) do
		if not isNan(v) then
			set[v] = true
		end
	end

	return set
end

------------------------------------------------------------------------------------
-- deepCopy
--
-- Recursive deep copy function. Preserves identities of subtables.
------------------------------------------------------------------------------------
local function _deepCopy(orig, includeMetatable, already_seen)
	if type(orig) ~= "table" then
		return orig
	end
	
	-- already_seen stores copies of tables indexed by the original table.
	local copy = already_seen[orig]
	if copy ~= nil then
		return copy
	end
	
	copy = {}
	already_seen[orig] = copy -- memoize before any recursion, to avoid infinite loops
	
	for orig_key, orig_value in pairs(orig) do
		copy[_deepCopy(orig_key, includeMetatable, already_seen)] = _deepCopy(orig_value, includeMetatable, already_seen)
	end
	
	if includeMetatable then
		local mt = getmetatable(orig)
		if mt ~= nil then
			setmetatable(copy, _deepCopy(mt, true, already_seen))
		end
	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 or {})
end

------------------------------------------------------------------------------------
-- sparseConcat
--
-- 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 arr = {}

	local arr_i = 0
	for _, v in p.sparseIpairs(t) do
		arr_i = arr_i + 1
		arr[arr_i] = v
	end

	return table.concat(arr, sep, i, j)
end

------------------------------------------------------------------------------------
-- length
--
-- Finds the length of an array, or of a quasi-array with keys such as "data1",
-- "data2", etc., using an exponential search algorithm. 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, prefix)
	-- requiring module inline so that [[Module:Exponential search]] which is
	-- only needed by this one function doesn't get millions of transclusions
	local expSearch = require("Module:Exponential search")
	checkType('length', 1, t, 'table')
	checkType('length', 2, prefix, 'string', true)
	return expSearch(function (i)
		local key
		if prefix then
			key = prefix .. tostring(i)
		else
			key = i
		end
		return t[key] ~= nil
	end) or 0
end

------------------------------------------------------------------------------------
-- inArray
--
-- Returns true if searchElement is a member of the array, and false otherwise.
-- Equivalent to JavaScript array.includes(searchElement) or
-- array.includes(searchElement, fromIndex), except fromIndex is 1 indexed
------------------------------------------------------------------------------------
function p.inArray(array, searchElement, fromIndex)
	checkType("inArray", 1, array, "table")
	-- if searchElement is nil, error?

	fromIndex = tonumber(fromIndex)
	if fromIndex then
		if (fromIndex < 0) then
			fromIndex = #array + fromIndex + 1
		end
		if fromIndex < 1 then fromIndex = 1 end
		for _, v in ipairs({unpack(array, fromIndex)}) do
			if v == searchElement then
				return true
			end
		end
	else
		for _, v in pairs(array) do
			if v == searchElement then
				return true
			end
		end
	end
	return false
end

------------------------------------------------------------------------------------
-- merge
--
-- Given the arrays, returns an array containing the elements of each input array
-- in sequence.
------------------------------------------------------------------------------------
function p.merge(...)
	local arrays = {...}
	local ret = {}
	for i, arr in ipairs(arrays) do
		checkType('merge', i, arr, 'table')
		for _, v in ipairs(arr) do
			ret[#ret + 1] = v
		end
	end
	return ret
end

------------------------------------------------------------------------------------
-- extend
--
-- Extends the first array in place by appending all elements from the second
-- array.
------------------------------------------------------------------------------------
function p.extend(arr1, arr2)
	checkType('extend', 1, arr1, 'table')
	checkType('extend', 2, arr2, 'table')

	for _, v in ipairs(arr2) do
		arr1[#arr1 + 1] = v
	end
end

return p
婊是什么意思 取保候审需要什么条件 肝炎吃什么药好 收放自如是什么意思 班门弄斧什么意思
特斯拉用的是什么电池 鲐背之年是什么意思 梅毒是什么症状 75年的兔是什么命 梦见洗澡是什么意思
丹毒病是什么原因引起的 尿酸高早餐吃什么 工体是什么意思 失眠吃什么食物效果最好 大姨妈期间适合吃什么水果
81岁属什么 妯娌关系是什么意思 股骨头坏死挂什么科 女孩叫兮兮是什么意思 8月9号是什么星座
胎儿缺氧是什么原因造成的hkuteam.com 爱困总想睡觉什么原因zsyouku.com 251是什么意思hcv7jop4ns7r.cn 吃什么水果好hcv8jop8ns0r.cn 京东什么时候有活动travellingsim.com
男女双修什么意思hcv8jop5ns0r.cn 吟诗作赋是什么意思hcv7jop5ns1r.cn 玉和玉髓有什么区别naasee.com 精神焦虑症有什么表现有哪些hcv8jop4ns0r.cn 舌头根发麻是什么原因weuuu.com
恶寒是什么意思cj623037.com dce是什么溶剂hcv9jop6ns0r.cn 婴儿掉头发是什么原因hcv9jop1ns4r.cn 情商是什么zhongyiyatai.com 结论是什么意思hcv9jop6ns0r.cn
请人原谅说什么baiqunet.com 86属什么生肖hcv8jop9ns8r.cn 自己家院子种什么树好wmyky.com 甲状腺2类是什么意思hcv9jop3ns6r.cn 掉头发吃什么药最有效bfb118.com
百度