清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
-- --常用公共函数库 -- local FUNC = {} --to int FUNC.int = function(sString) local iNum = tonumber(sString) iNum = ((iNum == nil) and tonumber(0)) or iNum return iNum end --将字符串分割成数组,同php: explode FUNC.explode = function(szFullString, szSeparator) local nFindStartIndex = 1 local nSplitIndex = 1 local nSplitArray = {} while true do local nFindLastIndex = string.find(szFullString, szSeparator, nFindStartIndex) if not nFindLastIndex then nSplitArray[nSplitIndex] = string.sub(szFullString, nFindStartIndex, string.len(szFullString)) break end nSplitArray[nSplitIndex] = string.sub(szFullString, nFindStartIndex, nFindLastIndex - 1) nFindStartIndex = nFindLastIndex + string.len(szSeparator) nSplitIndex = nSplitIndex + 1 end return nSplitArray end --将日期转换为时间戳,date(Y-m-d H:i:s) 同php strtotime,只支持 1970-01-01 08:00:00 格式 --返回时间戳 FUNC.strtotime = function(sDate) local iTime = 0 if 0 == string.len(sDate) then return iTime end local sDateymd = string.sub(sDate, 1, 10) local sDatehis = string.sub(sDate, 12, -1) local aDateymd = FUNC.explode(sDateymd, '-') local aDatehis = FUNC.explode(sDatehis, ':') local Y,m,d = aDateymd[1], aDateymd[2], aDateymd[3] local H,i,s = aDatehis[1], aDatehis[2], aDatehis[3] iTime = os.time({year=Y, month=m, day=d, hour=H, min=i,sec=s}) return iTime end return FUNC