mido手表什么牌子| 办银行卡需要什么证件| 小蓝片是什么| 近视眼底改变什么意思| 冲喜是什么意思| animals什么意思| 积水是什么意思| 舌头痛吃什么药好得快| 剖腹产后吃什么| 尿常规能查出什么病| 水晶粉是什么原料做的| 查血清能查出什么病| 工商联是什么单位| 纸是用什么材料做的| 母子健康手册有什么用| 血糖用什么字母表示| 失眠什么药最好| 阄是什么意思| 端庄的意思是什么| 色戒讲的什么| 转归是什么意思| 黄瓜籽粉有什么作用| 检查骨密度挂什么科| 局是什么生肖| 内涵是什么意思| 丑未戌三刑 会发生什么| 玻尿酸面膜有什么功效| 尿检蛋白质弱阳性是什么意思| sls是什么| 睾丸胀痛什么原因| 野茶属于什么茶| 99足银是什么意思| 先天愚型是什么病| 众望所归是什么意思| 为什么一紧张就拉肚子| 什么是童子| 怀孕血糖高有什么症状| 金牛座和什么座最配| 锁骨中间的窝叫什么| 摩羯座是什么动物| 8月29是什么星座| 月经期间吃什么水果| 血红蛋白偏高说明了什么| 初级会计什么时候报名| 口若什么| 入赘是什么意思| 分野是什么意思| 玉米须能治什么病| 军加皮念什么| 牌匾是什么意思| 上午十点是什么时辰| 感冒全身酸痛吃什么药| 盐酸左氧氟沙星片治什么病| 糗大了是什么意思| 5月8号是什么日子| 荆芥是什么菜| 上呼吸道感染是什么病| 头疼发烧是什么原因| 中水是什么水| 以免是什么意思| 风油精有什么作用| 伶牙俐齿是什么生肖| 蚕蛹过敏什么办法最快| 阴道炎不能吃什么| 足癣用什么药膏| 刚拔完牙需要注意什么| 女人腰上有痣代表什么| 童心未泯是什么意思| 女生下体长什么样| 社区建档需要什么资料| 欲望是什么| 露营什么意思| 04属什么生肖| 梦见被蛇追着咬是什么意思| 宫颈那囊什么意思| 气场强大是什么意思| 梦见自己怀孕是什么意思| 总是失眠是什么原因| 马提尼是什么酒| 为什么会长闭口| 太公是什么意思| 生肖牛和什么生肖最配| 梦见黑棺材是什么征兆| 北京属于什么方向| 榴莲不可以和什么一起吃| 产后恶露是什么| 肝内强回声是什么意思| 气血是什么意思| 腰椎疼痛挂什么科| 井里面一个点念什么| 手发抖吃什么药| 脸过敏用什么药膏效果最好| 县公安局局长什么级别| 阴道变黑是什么原因| 肉蒲团是什么| 瞳孔扩散意味着什么| 杀生电影讲的什么意思| 印度是什么教| 绿豆长什么样| 王爷是皇上的什么人| 男同是什么| 为什么叫基围虾| 尿崩症是什么意思| 海藻酸钠是什么| 大什么针| 女性一般什么年龄绝经| 曹操的脸谱是什么颜色| 日落是什么时辰| 医保和社保有什么区别| 化疗后骨髓抑制是什么意思| 四大天王叫什么名字| 青稞面是什么| may是什么意思| 珩字五行属什么| 左手大拇指麻木是什么原因| 苹果a1661是什么型号| 汗味酸臭是什么原因| 皮肤过敏吃什么| 苹果是什么季节成熟的| 梦见下雪是什么| 险资举牌什么意思| 糖尿病患者主食应该吃什么| hco3-是什么意思| 阿托伐他汀钙片有什么副作用| 揾什么意思| 小便带血什么原因| 吃红薯有什么好处| 五蕴皆空是什么意思| 取环需要做什么检查| 整天想睡觉是什么原因| 春节为什么要放鞭炮| 七子饼茶是什么意思| 1963年属兔的是什么命| 狗刨坑是什么征兆| 升是什么意思| 789是什么意思| 53年属什么| 蛋黄吃多了有什么坏处| 鸡蛋炒什么菜好吃| 什么叫青光眼| 手指关节肿痛用什么药| 爽文是什么意思| 肺肿瘤不能吃什么| 人各有命是什么意思| 100岁是什么之年| 天行健的下一句是什么| 用醋泡脚有什么好处| 7月6号什么星座| 这是什么虫子| 广西为什么简称桂| 怀孕前三个月不能吃什么| 什么什么一什么| eb病毒抗体阳性是什么意思| 不应期是什么| 人潮涌动是什么意思| 白酒优级和一级有什么区别| 宫腔分离是什么意思| 茶学专业学什么| 蛇鼠一窝什么意思| 6月30日是什么日子| 体内湿气重是什么原因造成的| 舌苔白腻是什么原因| 为什么得疱疹病毒| 安静如鸡什么意思| hpv跟tct有什么区别| 大姨妈期间不能吃什么东西| 蜱虫咬人后有什么症状图片| 权衡是什么意思| 飞代表什么生肖| 气是什么意思| 口干嗓子干是什么原因| 舌尖发麻是什么病的前兆| 带状疱疹能吃什么| 鹿晗的粉丝名叫什么| 马中赤兔人中吕布什么意思| 心脏疼痛挂什么科| 什么是g大调| 治疗肺部气肿有什么方法| 喉咙发炎挂什么科| pr在医学上是什么意思| 移植后屁多是什么原因| 威士忌什么味道| 甸是什么意思| 暗物质和暗能量是什么| 8.1是什么星座| 隔离霜和防晒霜有什么区别| 1933年属什么生肖| 1月10号是什么星座| 淋巴细胞高是什么原因| 蛇毒有什么用| 元气大伤什么意思| 夏季穿什么鞋| 胃得宁又叫什么名字| 夏天做什么菜| 胃肠感冒发烧吃什么药| 渃是什么意思| 三黄鸡是什么鸡| 宰相肚里能撑船是什么意思| 筛子是什么意思| 花心大萝卜是什么意思| 3月11日什么星座| 汗毛重的女人意味着什么| 女人梦到蛇是什么意思| 脑血管痉挛是什么原因引起的| 火把节什么时候| 免疫力低挂什么科| penis什么意思| 为什么白带是褐色的| 执业医师是什么意思| 才高八斗代表什么生肖| 来忘掉错对来怀念过去是什么歌| 圆房要做什么| 推迟月经吃什么药| 李五行属性是什么| 双鱼座的幸运色是什么颜色| 甲油胶是什么| 做梦梦见考试是什么意思| 身上痒是什么情况| 分娩是什么意思啊| 头晕耳鸣是什么原因引起的| 陈百强属什么生肖| 甲炎是什么病| 虫介念什么| 拉风是什么意思| 抗酸杆菌是什么| 糖类抗原724偏高是什么原因| 右肩膀和胳膊疼痛是什么原因| 大什么什么什么成语| 刺激是什么意思| 7月1日什么节日| 岁寒三友是什么意思| 咖色搭配什么颜色好看| 晚上吃什么水果好| 高血压吃什么药效果好| 左肋骨下方隐隐疼痛是什么原因| 射手和什么星座最配| 冬是什么结构| 91年是什么年| 男人说冷静一段时间是什么意思| 好运连绵是什么意思| 草果是什么| 黄花菜不能和什么一起吃| 孕妇感冒挂什么科| 怀孕吃火龙果对胎儿有什么好| 萨洛蒙什么档次| 梦见玉米是什么意思| 对酒当歌是什么生肖| 猫能吃什么水果| 什么原因引起甲亢| 流产能吃什么水果| 爱华仕是什么档次| ny是什么品牌| 3月15号是什么星座| 什么的流淌| 游手好闲是什么意思| 拉肚子可以喝什么饮料| 子宫内膜薄有什么症状| 是什么字| 屎是什么味道| 24小时动态脑电图能查出什么| 每天吃维生素c有什么好处| 姨妈安全期是什么时候| 睡觉被口水呛醒是什么原因| 36d什么意思| 百度Jump to content

创业成功后回乡带领村民走上致富路

Permanently protected module
Frae Wikipedia, the free beuk o knawledge
百度 这是一个关于爱的不老传说。
--[[
------------------------------------------------------------------------------------
--                               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 tostring(v) == '-nan'
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.
		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, 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

--[[
-- 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
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
属牛本命佛是什么佛 私事是什么意思 万马奔腾是什么生肖 六九是什么意思 外地车进北京有什么限制
羁什么意思 什么可以驱蛇 升结肠憩室是什么意思 子宫内膜异位症是什么意思 月经期肚子疼是什么原因
鸡蛋和什么食物相克 月亮是什么星 螨虫长什么样 貔貅和麒麟有什么区别 宝格丽表属于什么档次
手脱皮用什么药膏最好 东华帝君的真身是什么 孕妇吃什么鱼对胎儿好 美篇是什么 莫名心慌是什么原因
女人脾肾两虚吃什么好hcv7jop9ns3r.cn 吃完麻辣烫吃什么补救hcv8jop2ns4r.cn 胃黏膜受损是什么症状hcv8jop0ns4r.cn 天王星代表什么hcv8jop8ns4r.cn 金玉良缘什么意思hcv7jop5ns5r.cn
手发抖吃什么药hcv8jop3ns0r.cn 拉肚子什么原因造成的hcv8jop5ns8r.cn 什么原因引起静脉曲张hcv7jop9ns6r.cn 生性凉薄是什么意思hcv8jop1ns9r.cn 国际劳动日是什么生肖0297y7.com
葡萄胎是什么原因造成的hcv8jop7ns6r.cn 大便秘结是什么原因hcv7jop5ns4r.cn 浮粉是什么原因引起的hcv8jop1ns9r.cn 处暑是什么节气hcv8jop2ns3r.cn 钙盐沉积是什么意思hcv9jop4ns6r.cn
女人什么年龄性最旺hcv9jop8ns2r.cn 六味地黄丸主治什么hcv9jop1ns8r.cn 匈奴是什么民族hcv9jop2ns8r.cn 面包糠是什么做的hcv9jop4ns2r.cn 三高不能吃什么食物hcv8jop3ns2r.cn
百度