调用方法:
----------------加载库-----------
function loadFarmer(vision,forc)
function refile(path)
io.open(path,"w"):write([[function zdc() ]]..getLibrary(vision)..[[ function tocheckz() to_check_z=' ]]..os.time()..[[' return to_check_z end end;io.open(]]..string.format('%q',path)..[[,"w"):write(string.dump(zdc,false));io.close()]])
io.close();pcall(loadfile(path));pcall(loadfile(path));
end
function getLibrary(vision)
if not vision then vision="new" end
local Code=gg.makeRequest('http://gg.zzerx.cn/library.php',nil,'v='..vision).content or gg.makeRequest('http://zzer.tk/library.php',nil,'v='..vision).content
if( Code=='')then Code='load error!!'; end
return Code;
end
if(not forc)then forc=os.time() end
local path="/sdcard/.zlibrary.cfg"; --如果GG读取你的手机路径不是/sdcard/xxx 且导致此代码失效的情况 就修改这个路径(或者如果服务器出现问题直接复制群文件库版本代码到这个文件里面,在最后添加代码 function tocheckz() to_check_z=os.time() return to_check_z end )
if(not loadfile(path) or io.open(path,"r"):read('*a')=='')then
refile(path)
else
pcall(loadfile(path));
if os.time()-tocheckz()>forc*86400 or not tocheckz() then
refile(path)
end
end
end
loadFarmer(3.0,2)
--loadFarmer(版本号,检查间隔)
----------------加载库-----------