function comparetime(strtime1, strtime2)
	--比较现在的时间是不是在strtime1和strtime2之间
	--比如  comparetime("20:00", "23:00")
	--如果是就返回真
	local time1 = os.date("*t")
	local time2 = os.date("*t")
	time1.hour = strtime1:sub(1,2)
	time1.min  = strtime1:sub(4,5)
	time2.hour = strtime2:sub(1,2)
	time2.min  = strtime2:sub(4,5)
	return os.time() >= os.time(time1) and os.time() <= os.time(time2)
end

function maxinum(a)
    local mi = 1
    local m = a[mi]
    for i,val in ipairs(a) do
       if val > m then
           mi = i
           m = val
       end
    end
    return mi
end

function mininum(a)
    local mi = 1
    local m = a[mi]
    for i,val in ipairs(a) do
       if val < m then
           mi = i
           m = val
       end
    end
    return mi
end

function IsInTable(tbl, value)
	local 小写 = string.lower(value)
	for k,v in ipairs(tbl) do
		if v == value or string.lower(v) == 小写 then
			return true
		end
	end
	return false
end

oldtonumber = tonumber
function mytonumber(str,default)
	local value = oldtonumber(str)
	if value == nil then
		if default ~= nil and type(default) == "number" then
			value = default
		else
			value = 0
		end
	end
	return value
end

tonumber = mytonumber

function 获取取消下单物品数(t, strWP)
	if type(t) == "table" and #t > 0 and type(strWP) == "string" and strWP ~= "" then
		for _, v in ipairs(t) do
			if type(v) == "table" then
				if v[1] == strWP then
					return v[2], v[3]
				end
			end
		end
	end
	return -1, false
end

function 计算表达式(表达式)
	return load("return " .. 表达式)()
end
