[瑙﹀姩绮剧伒]闆跺熀纭€灏忕櫧瀛﹁Е鍔?-8

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[瑙﹀姩绮剧伒]闆跺熀纭€灏忕櫧瀛﹁Е鍔?-8相关的知识,希望对你有一定的参考价值。

鏍囩锛?a href='http://www.mamicode.com/so/1/%e7%9b%b8%e4%ba%92' title='鐩镐簰'>鐩镐簰   鏂囦欢   閿欒澶勭悊鍑芥暟   source   瀹屾暣璺緞   绉诲姩   app   灏忕櫧   pack   

闆跺熀纭€灏忕櫧瀛﹁Е鍔?- 05 - 瑙﹀姩甯哥敤鍑芥暟


鐐瑰嚮 婊戝姩 鍘熺悊

鍏跺疄閮藉彲浠ュ垎瑙f垚 鎸変笅=銆?绛夊緟涓€瀹氭椂闂存垨鑰呯Щ鍔ㄥ姩浣?銆?nbsp; 鏉惧紑 

鐐瑰嚮锛?tSLib搴撶殑鍑芥暟tap(x,y) 鍚庨潰杩樻湁2涓弬鏁?鍙互鑷繁鐪嬫墜鍐?nbsp; https://www.zybuluo.com/miniknife/note/293935#鍑芥暟tap-鐐瑰嚮

婊戝姩  moveTo(x1,y1,x2,y2,step)   璇︾粏鐨?nbsp;  https://www.zybuluo.com/miniknife/note/293935#鍑芥暟moveto-婊戝姩

锛熷浣曞疄鐜扮簿纭粦鍔?nbsp; https://zimaoxy.com/b/t-860-1-3.html 娣卞叆鐮旂┒  鏆傛椂杩樻病鐞嗚В鎬濊矾 鑰岃Е鍔ㄦ墜鍐岄噷闈㈢粰鐨勪緥瀛愭祴璇曡繃  鏃犳硶鍋氬埌瀹岀編鐨勭簿纭粦鍔?灏变笉鐢ㄤ簡 杩樻湁鍏朵粬妯″紡鐨勬粦鍔?鍦ㄥ綋鍓嶆粦鍔ㄦ棤鏁堢殑鎯呭喌涓?p>寤舵椂 mSleep()

鍧愭爣鍒濆鍖栧嚱鏁?nbsp; init(0)  娌′粈涔堣鐨?0鏄痟ome鍦ㄤ笅 1鏄痟ome鍦ㄥ彸 2鏄痟ome鍦ㄥ乏  鑴氭湰寮€濮嬭鍧愭爣鍒濆鍖栦笅  鑰屼笖涓嶈兘鎶奿nit() 鏀惧埌鍏朵粬鏂囦欢鐒跺悗require瀵煎叆 鏄main.lua鏃犳晥鐨?琛€娉殑鏁欒


灏忕煡璇嗭細require 璋冪敤鏂囦欢鐨勪娇鐢ㄦ敞鎰?
  1. require浼氳嚜鍔ㄥ垽鏂綋鍓嶅師鐮佹槸鍚﹀凡缁忚浇鍏ヨ鏂囦欢 濡傛灉宸茬粡杞藉叆杩欎釜鏂囦欢灏变笉浼氬啀缁х画杞藉叆 缁欐垜浠竴涓渷浜嬬殑鐢ㄦ硶

  2. 鏃犳硶鍙犲姞require 姣斿璇?鎴戝湪涓昏剼鏈噷闈㈣皟鐢ㄨ嚜宸辩殑妯$増 浣嗘槸鍦ㄨ嚜宸辩殑妯$増閲岄潰璋冪敤 TSLib搴?杩欐牱鏄棤娉曞湪涓昏剼鏈噷闈㈢洿鎺ヨ皟鐢═SLib搴撶殑 鍙兘鐩存帴鍦ㄤ富鑴氭湰閲岄潰杞藉叆TSLib

  3. 澶氫釜璋冪敤鏂囦欢涔嬮棿鐨勫嚱鏁?琛?鍙橀噺鐨勪簰閫氭儏鍐电殑娉ㄦ剰浜嬮」

骞朵笉娓呮lua瀹炵幇鐨勫師鐞?浣嗘槸涔熷媺寮烘€荤粨浜嗕竴浜涚粡楠?p>1.鍑犱釜鏂囦欢鐩镐簰璋冪敤鐨勬儏褰笅  鏂囦欢鍐呯殑鍙橀噺鍑芥暟琛ㄦ垨鑰呭叾浠栨暟鎹被鍨?濡傛灉鎯宠鍏朵粬鏂囦欢涔熷彲浠ヨ嚜鐢辫皟鐢?/font> 閭d箞鍗冧竾涓嶈兘鍔爈ocal鍙樻垚灞€閮ㄥ彉閲?/font> 涓汉鍘熸潵寰堝枩娆㈠敖鍙兘鐨勫噺灏戝叏灞€鍙橀噺鐨勬暟姣嶆潵鎻愰珮鏁堢巼浣嗘槸杩欐牱浼氬鑷村緢澶氳皟鐢ㄩ棶棰? 灏辩畻鏄湪main.lua鐨勬渶澶栧眰 鐢╨ocal澹版槑鐨勪吉灞€閮ㄥ彉閲忎篃涓嶈

2.濡傛灉鏌愪釜琚皟鐢ㄦ枃浠跺唴鐨勫嚱鏁版垨鑰呰〃 璋冪敤浜嗗叾浠栨枃浠剁殑鍙橀噺 鍑芥暟 鎴栬€呰〃  娉ㄦ剰璋冪敤鏃跺€欏弻鏂圭殑鍓嶅悗浣嶇疆  鍥犱负 濡傛灉 鍏朵粬鏂囦欢鐨勫彉閲?鍑芥暟 鎴栬€呰〃 灏氭湭杞藉叆瀹屾垚 鎴戜滑灏卞紩鐢ㄤ簡 琚皟鐢ㄦ枃浠跺唴鐨勫嚱鏁版垨鑰呰〃  閭d箞鑷劧鍙備笌杩愮畻鐨勫彉閲忓嚱鏁拌〃涔熸槸绌虹殑


灏忕煡璇?鍙栬壊鍣ㄧ殑涓€涓ˉ鍏?R蹇嵎閿殑浣滅敤

鐢ㄤ簬涓ゅ紶鎴浘鐨勫涓浉鍚屽潗鏍囩殑棰滆壊鐨勫姣?nbsp; 姣旀寜閿殑鍒囨崲鍥剧墖瀵规瘮鏇村姞绮剧粏

鎶€鏈浘鐗? width=

鍦ㄧ涓€寮犲浘鐗囦笂鍙栧涓偣 杩欓噷灏卞湪钃濊壊瀵瑰嬀涓婂彇鐐?/p>

鎶€鏈浘鐗? width=

鍒囨崲鍒扮浜屼釜鍥剧墖 鐐瑰嚮蹇嵎閿甊 鍧愭爣娌″彉鍖?浣嗘槸杩欓噷鏄剧ず鏄浜屽紶鍥剧墖鐨勯鑹蹭簡

鎶€鏈浘鐗? width=



灏忕煡璇?nLog()鍑芥暟鐨勬敞鎰忎簨椤?/strong>

1.杈撳嚭鏃ュ織鍒拌Е鍔ㄧ簿鐏?IDE 缂栬緫鍣?nbsp;

2.鐢?font color="#ff0000">瑙﹀姩绮剧伒鑴氭湰缂栬緫鍣ㄥ彂璧风殑鑴氭湰杩愯灏嗕細鎺ユ敹鍒?nLog 鍥炰紶淇℃伅锛屽叾浠栨柟寮忚繍琛岀殑鑴氭湰灏嗕笉浼氳Е鍙?nLog 鍑芥暟  鐨勭‘鐩稿綋浜庢寜閿殑traceprint

for i=1,20 do
     nLog(tostring(i))
end

缁撴灉

20
19
18
17
16
15
13
12
11
10
9
6
8
7
5
3
2
1
14

浠庣粨鏋滅湅 涓嶅崟鍗曡緭鍑虹殑鍐呭鏄€掔潃鐨?鑰屼笖姣斿14杩樺嚭鐜板湪1涔嬪墠 椤哄簭涔熸槸涔辩殑  鏄棩蹇楁槸寮傛鐢熸垚鐨?瀵艰嚧鐨?/p>

瑙e喅鍔炴硶锛?/strong>

nLog涔嬮棿鍔犱笂涓€鐐圭偣寤惰繜缁忚繃娴嬭瘯 寤惰繜涓?ms鐨勮瘽渚濈劧鏃犳硶瑙e喅闂 鍙互璁剧疆涓?0ms 灏遍『搴忔甯镐簡

for i=1,20 do
     nLog(tostring(i))
     mSleep(5)
end

涓轰簡褰诲簳瑙e喅杩欎釜闂  鏆傛椂鎯冲埌鐨勮В鍐冲姙娉?/p>

function nLogEx(str)
    nLog(str)
    mSleep(10)
end
--涓嬮潰鏄渶甯哥敤鐨勬樉绀哄綋鍓嶅摢涓枃浠跺拰绗嚑琛?涔熷閲岄潰nLog鍋氫簡澶勭悊
function traceprint(str)
    local info = debug.getinfo(2) 
    nLog("[" .. tostring(info["source"]) .. "]" .. "绗?/span>" .. tostring(info["currentline"]) .. "琛? " .. tostring(str))
    --nLog("[" .. string.format("%s:%d:", info["source"]:match(".*\\([^\\]*)")) .. "]" .. "绗? .. tostring(info["currentline"]) .. "琛? " .. tostring(str))    
    mSleep(5)--涓轰簡nLog鐨勬樉绀洪『搴忕殑鏆傛椂瑙e喅鍔炴硶
end



灏忕煡璇?nLog()鍑芥暟鏃犳硶婊¤冻闇€姹?nbsp; 鍥犱负鎴戝垰鍙戠幇瑙﹀姩鐨勬棩蹇楃郴缁熺湡鐨勫緢寮哄ぇ 涓婇潰閭d釜鏃ュ織鍑芥暟骞朵笉瀹屽杽

http://www.cncrk.com/downinfo/117279.html --瀹樻柟缇ょ鐞嗗憳璇磋繖涓病闂  涓€涓眬鍩熺綉鏌ョ湅瑙﹀姩鏃ュ織鐨勫伐鍏?/p>

--銆愯剼鏈疄渚嬨€?/span>
--1銆佸啓鍒版湰鍦版棩蹇?/span>
initLog("test", 0);--鎶?0 鎹㈡垚 1 鍗崇敓鎴愬舰浼?test_1397679553.log 鐨勬棩蹇楁枃浠?
wLog("test","[DATE] Test_1 OK!!!"); 
mSleep(500);
wLog("test","[DATE] Test_2 OK!!!");
closeLog("test"); --鍏抽棴鏃ュ織
--2銆佸彂閫佹湇鍔″櫒鏃ュ織
initLog("192.168.1.1", 2); --鍒濆鍖栨棩蹇楋紝骞朵互寮傛鏂瑰紡鍙戦€侊紱鎶?2 鎹㈡垚 3 鍗充负鍚屾鍙戦€?/span>
wLog("192.168.1.1", "[DATE] Test OK!!!"); --灏嗘棩蹇楀彂閫佸埌 192.168.1.1
closeLog("192.168.1.1"); --鍏抽棴鏈嶅姟鍣ㄨ繛鎺?/span>
--3銆佸鏃ュ織璁板綍
initLog("test_1", 0);
initLog("test_2", 0); 
wLog("test_1","[DATE] Test_1 OK!!!"); 
mSleep(500);
wLog("test_2","[DATE] Test_2 OK!!!"); 
closeLog("test_1"); closeLog("test_2");


绠€鏄撶殑渚嬪瓙

--閬垮厤鏃ュ織椤哄簭涓嶅鐨勫鏃ュ織鍑芥暟鐨勫皝瑁?/span>
function nLogEx(str)
    nLog(str)
    mSleep(5)
end
--wLog鍔犲己鐗?鍙渶瑕佸啓鏃ュ織鍐呭灏卞ソ 涓嶉渶瑕佸~鍐欐棩蹇楁枃浠跺悕鍜孾data]浜?/span>
--闇€瑕侀厤缃〃鐨勬棩蹇楁枃浠跺厓绱?/span>
--杩愯鍚?鍦ㄦ棩蹇楄緭鍑虹獥鍙e彲浠ョ湅鍒癗log鐨勪俊鎭?涔熷彲浠ュ湪瀵瑰簲鐨勬棩蹇楁枃浠堕噷闈㈡壘鍒皐Log鐨勬棩蹇楄褰?
function wLogEx(contents)    
    if config["isLog"] then
        wLog(config["logFileName"], tostring(contents))
        nLogEx(contents)
    end
end

--閰嶇疆鍖?/span>
config=
----鑴氭湰淇℃伅
config["author"]="鐐规淮绉疮"--浣滆€?/span>
config["QQ"]="1847154827"--QQ
config["scriptName"]="娴嬭瘯鑴氭湰涓€"--鑴氭湰鍚嶅瓧
----鏃ュ織鐩稿叧(鏆傛椂涓嶈€冭檻澶氭棩蹇楀苟瀛樼殑鎯呭喌)
config["isLog"]=true--鏄惁寮€鍚棩蹇?鍖呭惈鏃ュ織杈撳嚭绐楀彛鍜屾棩蹇楁枃浠朵袱閮ㄥ垎)
config["logFileName"]=tostring(config["scriptName"]) .. tostring(os.date("%Y%m%d%H%M%S",os.time())) --鍙槸褰撳墠鏃ュ織鏂囦欢鍚嶅瓧涓嶆槸瀹屾暣璺緞骞存湀鏃ユ椂鍒嗙 濡俋XXX20190816112336 鍔犱簡涓墠缂€
config["logMode"]=0--0琛ㄧず鍐欏叆鏈湴鏃ュ織鏂囦欢--1 - 鐢熸垚 1 涓互鏃堕棿鎴冲懡鍚嶇殑鍚庣紑涓?.log 鐨勬枃浠跺埌 log 鏂囦欢澶逛笅 2 - 寮傛鍙戦€佸埌鏈嶅姟鍣紙鏀寔寮曟搸 v1.7.0 鍙?android v2.4.1 浠ヤ笂鐗堟湰锛? - 鍚屾鍙戦€佸埌鏈嶅姟鍣紙浠呮敮鎸佽Е鍔ㄧ簿鐏?ios v1.7.0 鍙婁互涓婄増鏈級

--鍒濆鍖栧尯
init(0)--璁剧疆鍧愭爣鍒濆鍖?杩欎釜鍒濆鍖栧繀椤诲湪main.lua涓嬪0鏄?涓嶇劧鏁翠釜鍧愭爣閮戒細鍑洪棶棰?/span>
if config["isLog"] then
    initLog(tostring(config["logFileName"]), config["logMode"])--璁剧疆鏃ュ織鍒濆鍖?鏃ュ織鏂囦欢鍚嶅拰鏃ュ織妯″紡 鏃ュ織鍚嶇敱閰嶇疆琛ㄧ殑鍏冪礌鎻愪緵
end



--娴嬭瘯鍖?/span>
for i=1,20 do
    wLogEx("hello" .. tostring(i))
end



--閿€姣佸尯--鑴氭湰鍋滄鍓嶈鍋氱殑浜嬫儏
if config["isLog"] then
    closeLog(config["logFileName"]);
end



灏忕煡璇?beforeUserExit 閿€姣佷簨浠剁殑瑙﹀彂

姝ゅ嚱鏁板彲浠ヨ lua_exit()銆?code>闊抽噺閿仠姝?/code>銆?code>杩滅▼鎺ュ彛鍋滄 瑙﹀彂 浣嗘槸鑴氭湰鑷繁鎶ラ敊宕╂簝杩欎釜鎯呭喌浠栦笉浼氳Е鍙?杩樻湁鑴氭湰姝e父杩愯瀹屾瘯涔熶笉浼氳Е鍙?p>瀹為檯娴嬭瘯鍝簺鑳借Е鍙?/strong>

1.os.exit() X 涓嶄細姝e父瑙﹀彂beforeUserExit 閿€姣佷簨浠?nbsp; 涓嶄絾涓嶄細姝e父鐨勫仠姝?鑴氭湰杩樻湁涓€浜涘鎬殑琛ㄧ幇 涓嶈鐢╫s.exit()鍋滄鑴氭湰

2.lua_exit()鈭? 浠ュ悗浣跨敤杩欎釜鍋滄鑴氭湰

3.缂栬緫鍣ㄤ笂鐨勫仠姝㈡寜閽?鈭?/font>

4 闊抽噺鍑忓彿鈭?/font>



闆跺熀纭€灏忕櫧瀛﹁Е鍔?- 06 - 濡備綍鍐欑畝鍗曠殑鐐瑰嚮鑴氭湰

杩欒妭璇惧彧鏄彇鍧愭爣鐒跺悗鐐瑰嚮鑰屽凡


闆跺熀纭€灏忕櫧瀛﹁Е鍔?- 07 - 鎵捐壊

灏忕煡璇嗭細toast鐨勬樉绀洪棶棰?

鍥犱负杩欎釜涓滆タ鏄?strong>寮傛鏄剧ず 涓嬪浘鏄悓鏃跺憟鐜皌oast鍜宯log

鎶€鏈浘鐗?  src=鎶€鏈浘鐗? width=?

缁撹锛氬緢閬楁喚 杩欎釜toast鏃犳硶淇濊瘉瀹炴椂鐨勬樉绀轰俊鎭?/strong> 鍜屾寜閿殑showmessage鏃犳硶姣?p>

灏忕煡璇嗭細鑰佸笀鎻愬埌 浣跨敤涓枃鍙橀噺 鍙兘浼氬奖鍝嶆晥鐜?鎴戣嚜宸卞仛浜嗕釜娴嬭瘯 浠g爜濡備笅

鎶€鏈浘鐗?  src=鎶€鏈浘鐗? width=?

缁撴灉锛?

鎶€鏈浘鐗?  src=鎶€鏈浘鐗? width=?

鎶€鏈浘鐗?  src=鎶€鏈浘鐗? width=?

鎶€鏈浘鐗?  src=鎶€鏈浘鐗? width=?

缁撹锛氫腑鏂囧彉閲忓拰鑻辨枃鍙橀噺鍩烘湰娌″尯鍒?鍙互瀹夊績鐨勪娇鐢ㄤ腑鏂囧彉閲?nbsp; 涓嶈繃涓轰簡鐪佷簨鍙橀噺杩樻槸灏介噺鑻辨枃鎴栬€呮嫾闊虫妸


鐭ヨ瘑鐐?瑙﹀姩鐨勫鐐规壘鑹?澶氱偣姣旇壊 鎵惧浘 寰幆澶氱偣鎵捐壊 寰幆澶氱偣姣旇壊 寰幆鎵惧浘  绛夊緟澶氱偣鎵捐壊娑堝け 绛夌偣澶氱偣姣旇壊娑堝け 绛夊緟鎵惧浘娑堝け

--杈撳嚭鏃ュ織淇℃伅鍒版棩蹇楃獥鍙e拰鏃ュ織鏂囦欢 鏃ュ織鏂囦欢鐨勮緭鍑虹敱閰嶇疆琛ㄦ帶鍒?/span>
function traceprint(str)
    local info = debug.getinfo(2) 
    local tempStr="[" .. tostring(info["source"]) .. "]" .. "绗?/span>" .. tostring(info["currentline"]) .. "琛? " .. tostring(str)
    if config["isLog"] then
        wLog(config["logFileName"], tostring(tempStr))
    end
    nLog(tempStr)
    mSleep(5)--涓轰簡nLog鐨勬樉绀洪『搴忕殑鏆傛椂瑙e喅鍔炴硶
end
function try(block)
    local tablejoin = function (...)
        local result = 
        for _, t in ipairs(...) do
            if type(t) == "table" then
                for k, v in pairs(t) do
                    if type(k) == "number" then table.insert(result, v)
                    else result[k] = v end
                end
            else
                table.insert(result, t)
            end
        end
        return result
    end

    -- get the try function
    local try = block[1]
    assert(try)

    -- get catch and finally functions
    local funcs = tablejoin(block[2] or , block[3] or )

    -- try to call it
    local result_error = 
    local results = pcall(try)
    if not results[1] then
        -- run the catch function
        if funcs and funcs.catch then
            result_error = funcs.catch(results[2])
        end
    end

    -- run the finally function
    if funcs and funcs.finally then
        local result_fin = funcs.finally(table.unpack(results))
        if #result_fin > 0 then
            return table.unpack(result_fin)
        end
    end

    -- ok?
    if results[1] and #results > 1 then
        return table.unpack(results, 2, #results)
    else
        if #result_error > 0 then
            return table.unpack(result_error)
        else
            return nil
        end
    end
end
function catch(block)
    -- get the catch block function
    return catch = block[1]
end
function finally(block)
    -- get the finally block function
    return finally = block[1]
end
--[[
鍔熻兘锛氬鐐规壘鑹?interface 鐣岄潰 window 绐楀彛 Button 鎸夐挳
鍙傛暟锛氬氨鏄竴涓〃 鍩烘湰缁撴瀯 ddzs_zhujiemian_kaishiyouxiButton="娓告垙涓荤晫闈寮€濮嬫父鎴忔寜閽?,color, posandcolor, degree, x1, y1, x2, y2,orient=1, main = 0x101010,list = 0x202020
杩斿洖鍊?-1 1 -1琛ㄧず鎵句笉鍒?1琛ㄧず鎵惧埌 鍧愭爣鍦ㄥ叏灞€鍙橀噺intX,intY閲岄潰
--]]
function ddzs(tempTable)
    -- 1.妫€娴嬩紶閫掕繘鏉ョ殑鍙傛暟鐨勫悎娉曟€?杩欓噷灏辩舰浜?   
    -- 2.寮€濮嬩紶閫掕繘鏉ュ弬鏁拌繘琛屽鐐规壘鑹?   
    -- 3.鍒ゆ柇鏌ユ壘缁撴灉 杩斿洖鍑芥暟杩斿洖鍊?/span>
    return try
        function ()
            --涓嬮潰浠g爜闅忎究鍐?鏈夊彲鑳芥姏鍑哄紓甯稿嵆鍙?/span>
            local result=-1
            local startTime=os.time()
            local mark=tempTable[1] 
            local color=tempTable[2]
            local posandcolor=tempTable[3] 
            local degree=tempTable[4] 
            local x1=tempTable[5]  local y1=tempTable[6]  local x2=tempTable[7] local y2=tempTable[8] 
            local tempX=-1 local tempY=-1

            if type(tempTable[9])=="table" then
                tempX, tempY = findMultiColorInRegionFuzzy(color, posandcolor, degree, x1, y1, x2, y2,tempTable[9])
            else
                tempX, tempY = findMultiColorInRegionFuzzy(color, posandcolor, degree, x1, y1, x2, y2)
            end

            if tempX>-1  and tempY>-1  then
                result=1
                traceprint("[澶氱偣鎵捐壊] [" .. tostring(mark) .. "] 鍧愭爣:" .. tostring(tempX) .. "," ..tostring(tempY))                
                intX=tempX  intY=tempY
            else
                traceprint("[澶氱偣鎵捐壊] <" .. tostring(mark) .. "> 娌℃壘鍒?")        
            end

            return result
        end,
        catch
            function (errors)
                --杩欓噷瀵瑰簲鍑芥暟鍚嶈鏀?/span>
                traceprint("鍑芥暟[" .. tostring("ddzs") .. "] <" .. tostring(tempTable[1] ) .. "> 閿欒淇℃伅锛?/span>".. tostring(errors))
            end            
        
        
end

--[[
澶氱偣姣旇壊
鍙傛暟 "娓告垙涓荤晫闈寮€濮嬫父鎴忔寜閽?,array,dim,flag 娉ㄦ剰棰滆壊鏁扮粍鏄痻1,y1,棰滆壊鏁板€?鑰屼笉鏄互|鍒嗛殧
杩斿洖鍊?-1 1 -1琛ㄧず鎵句笉鍒?1琛ㄧず鎵惧埌 鍧愭爣鍦ㄥ叏灞€鍙橀噺intX,intY閲岄潰 鍧愭爣鍏跺疄灏辨槸棰滆壊缁勭涓€涓厓绱犵殑鍧愭爣
--]]
function ddbs(tempTable)
    return try
        function ()
            --涓嬮潰浠g爜闅忎究鍐?鏈夊彲鑳芥姏鍑哄紓甯稿嵆鍙?/span>
            local result=-1
            local startTime=os.time()
            local mark=tempTable[1] 
            local tempArray=tempTable[2]
            local dim=tempTable[3] 
            local flag=tempTable[4] 
            local tempX=-1 local tempY=-1

            if multiColor(tempArray,dim,flag) == true then                
                tempX=tonumber( tempArray[1][1]) or -1
                tempY=tonumber( tempArray[1][2]) or -1
                if tempX==-1 or  tempY==-1 then
                    error("绗竴棰滆壊椤瑰潗鏍囧瓨鍦ㄩ棶棰?/span>")
                else
                    result=1
                    traceprint("[澶氱偣姣旇壊] [" .. tostring(mark) .. "] 鍧愭爣:" .. tostring(tempX) .. "," ..tostring(tempY))                
                    intX=tempX  intY=tempY
                end
            else
                traceprint("[澶氱偣姣旇壊] <" .. tostring(mark) .. "> 娌℃壘鍒?")    
            end
            return result
        end,
        catch
            function (errors)
                --杩欓噷瀵瑰簲鍑芥暟鍚嶈鏀?/span>
                traceprint("鍑芥暟[" .. tostring("ddbs") .. "] <" .. tostring(tempTable[1] ) .. "> 閿欒淇℃伅锛?/span>".. tostring(errors))
            end            
        
        
end

--[[
--鎵惧浘 涓嶈繃瑙﹀姩瀵规壘鍥炬敮鎸佺殑濂藉樊 鎴浘杩橀渶瑕佺敤ps 
鍙傛暟 "娓告垙涓荤晫闈寮€濮嬫父鎴忔寜閽?,picpath, degree, x1, y1, x2, y2, alpha, type
杩斿洖鍊?-1 1 -1琛ㄧず鎵句笉鍒?1琛ㄧず鎵惧埌 鍧愭爣鍦ㄥ叏灞€鍙橀噺intX,intY閲岄潰
--]]
function zt(tempTable)
    return try
        function ()
            --涓嬮潰浠g爜闅忎究鍐?鏈夊彲鑳芥姏鍑哄紓甯稿嵆鍙?/span>
            local result=-1
            local startTime=os.time()
            local mark=tempTable[1] 
            local picpath=tempTable[2]
            local degree=tempTable[3] 
            local x1=tempTable[4]  local y1=tempTable[5]  local x2=tempTable[6] local y2=tempTable[7] 
            local alpha=tempTable[8] or 0
            local tempType=tempTable[9]
            local tempX=-1 local tempY=-1

            if tempType==nil then
                tempX, tempY = findImageInRegionFuzzy(picpath, degree, x1, y1, x2, y2, alpha)
            else
                tempX, tempY = findImageInRegionFuzzy(picpath, degree, x1, y1, x2, y2, alpha,tempType)
            end



            if tempX>-1  and tempY>-1  then
                result=1
                traceprint("[鎵惧浘] [" .. tostring(mark) .. "] 鍧愭爣:" .. tostring(tempX) .. "," ..tostring(tempY))                
                intX=tempX  intY=tempY
            else
                traceprint("[鎵惧浘] <" .. tostring(mark) .. "> 娌℃壘鍒?")        
            end
            return result
        end,
        catch
            function (errors)
                --杩欓噷瀵瑰簲鍑芥暟鍚嶈鏀?/span>
                traceprint("鍑芥暟[" .. tostring("zt") .. "] <" .. tostring(tempTable[1] ) .. "> 閿欒淇℃伅锛?/span>".. tostring(errors))
            end            
        
        
end

--[[
寰幆澶氱偣鎵捐壊
鍙傛暟  ("娓告垙涓荤晫闈寮€濮嬫父鎴忔寜閽?,color, posandcolor, degree, x1, y1, x2, y2,orient=1, main = 0x101010,list = 0x202020,10)
杩斿洖鍊?-1 1 -1琛ㄧず鎵句笉鍒?1琛ㄧず鎵惧埌 鍧愭爣鍦ㄥ叏灞€鍙橀噺intX,intY閲岄潰
--]]
function waitDdzs(tempTable,limitTime)
    return try
        function ()
            --涓嬮潰浠g爜闅忎究鍐?鏈夊彲鑳芥姏鍑哄紓甯稿嵆鍙?/span>
            local result=-1
            local startTime=os.time()
            local mark=tempTable[1] 
            local color=tempTable[2]
            local posandcolor=tempTable[3] 
            local degree=tempTable[4] 
            local x1=tempTable[5]  local y1=tempTable[6]  local x2=tempTable[7] local y2=tempTable[8] 
            local tempX=-1 local tempY=-1
            limitTime=tonumber(limitTime) or 5--榛樿鏄?绉掗檺鍒?/span>
            while(true) do
               if (os.time()- startTime)>limitTime then
                    --traceprint("鍒版椂闂翠簡璺冲嚭")
                    result=-1
                    break
               end
                if type(tempTable[9])=="table" then
                    tempX, tempY = findMultiColorInRegionFuzzy(color, posandcolor, degree, x1, y1, x2, y2,tempTable[9])
                else
                    tempX, tempY = findMultiColorInRegionFuzzy(color, posandcolor, degree, x1, y1, x2, y2)
                end

                if tempX>-1  and tempY>-1  then
                    result=1
                    intX=tempX  intY=tempY
                    --traceprint("鎵惧埌浜嗚烦鍑?)
                    break
                else
                            
                end
                mSleep(100)
            end        
            if result==1  then
                traceprint("[寰幆澶氱偣鎵捐壊] [" .. tostring(mark) .. "] 鍧愭爣:" .. tostring(tempX) .. "," ..tostring(tempY))                    
            else
                traceprint("[寰幆澶氱偣鎵捐壊] <" .. tostring(mark) .. "> 娌℃壘鍒?")
            end
    
            return result
        end,
        catch
            function (errors)
                --杩欓噷瀵瑰簲鍑芥暟鍚嶈鏀?/span>
                traceprint("鍑芥暟[" .. tostring("waitDdzs") .. "] <" .. tostring(tempTable[1] ) .. "> 閿欒淇℃伅锛?/span>".. tostring(errors))
            end            
        
        
end
--寰幆澶氱偣姣旇壊 
function waitDdbs(tempTable,limitTime)
    return try
        function ()
            --涓嬮潰浠g爜闅忎究鍐?鏈夊彲鑳芥姏鍑哄紓甯稿嵆鍙?/span>
            local result=-1
            local startTime=os.time()
            local mark=tempTable[1] 
            local tempArray=tempTable[2]
            local dim=tempTable[3] 
            local flag=tempTable[4] 
            local tempX=-1 local tempY=-1
            limitTime=tonumber(limitTime) or 5--榛樿鏄?绉掗檺鍒?/span>
            while(true) do
               if (os.time()- startTime)>limitTime then
                    --traceprint("鍒版椂闂翠簡璺冲嚭")
                    result=-1
                    break
               end
                if multiColor(tempArray,dim,flag) == true then                
                    tempX=tonumber( tempArray[1][1]) or -1
                    tempY=tonumber( tempArray[1][2]) or -1
                    if tempX==-1 or  tempY==-1 then
                        error("绗竴棰滆壊椤瑰潗鏍囧瓨鍦ㄩ棶棰?/span>")
                    else
                        result=1
                        intX=tempX  intY=tempY
                        break
                    end
                else
                    
                end            
                mSleep(100)
            end
            if result==1  then
                traceprint("[寰幆澶氱偣姣旇壊] [" .. tostring(mark) .. "] 鍧愭爣:" .. tostring(tempX) .. "," ..tostring(tempY))                
            else
                traceprint("[寰幆澶氱偣姣旇壊] <" .. tostring(mark) .. "> 娌℃壘鍒?")    
            end
            return result
        end,
        catch
            function (errors)
                --杩欓噷瀵瑰簲鍑芥暟鍚嶈鏀?/span>
                traceprint("鍑芥暟[" .. tostring("waitDdbs") .. "] <" .. tostring(tempTable[1] ) .. "> 閿欒淇℃伅锛?/span>".. tostring(errors))
            end            
        
    
end
--寰幆鎵惧浘
function waitZt(tempTable,limitTime)
    return try
        function ()
            --涓嬮潰浠g爜闅忎究鍐?鏈夊彲鑳芥姏鍑哄紓甯稿嵆鍙?/span>
            local result=-1
            local startTime=os.time()
            local mark=tempTable[1] 
            local picpath=tempTable[2]
            local degree=tempTable[3] 
            local x1=tempTable[4]  local y1=tempTable[5]  local x2=tempTable[6] local y2=tempTable[7] 
            local alpha=tempTable[8] or 0
            local tempType=tempTable[9]
            local tempX=-1 local tempY=-1
            limitTime=tonumber(limitTime) or 5--榛樿鏄?绉掗檺鍒?/span>
            
            while(true) do
               if (os.time()- startTime)>limitTime then
                    --traceprint("鍒版椂闂翠簡璺冲嚭")
                    result=-1
                    break
               end
                if tempType==nil then
                    tempX, tempY = findImageInRegionFuzzy(picpath, degree, x1, y1, x2, y2, alpha)
                else
                    tempX, tempY = findImageInRegionFuzzy(picpath, degree, x1, y1, x2, y2, alpha,tempType)
                end
                if tempX>-1  and tempY>-1  then
                    result=1
                    intX=tempX  intY=tempY
                    break
                else
                        
                end
                
                mSleep(100)
            end   
            
            
            if result==1  then
                traceprint("[寰幆鎵惧浘] [" .. tostring(mark) .. "] 鍧愭爣:" .. tostring(tempX) .. "," ..tostring(tempY))                
            else
                traceprint("[寰幆鎵惧浘] <" .. tostring(mark) .. "> 娌℃壘鍒?")    
            end
            return result
        end,
        catch
            function (errors)
                --杩欓噷瀵瑰簲鍑芥暟鍚嶈鏀?/span>
                traceprint("鍑芥暟[" .. tostring("waitZt") .. "] <" .. tostring(tempTable[1] ) .. "> 閿欒淇℃伅锛?/span>".. tostring(errors))
            end            
        
        
end
--绛夊緟澶氱偣鎵捐壊娑堝け
function waitDdzsDisappear(tempTable,limitTime)
    return try
        function ()
            --涓嬮潰浠g爜闅忎究鍐?鏈夊彲鑳芥姏鍑哄紓甯稿嵆鍙?/span>
            local result=-1
            local startTime=os.time()
            local mark=tempTable[1] 
            local color=tempTable[2]
            local posandcolor=tempTable[3] 
            local degree=tempTable[4] 
            local x1=tempTable[5]  local y1=tempTable[6]  local x2=tempTable[7] local y2=tempTable[8] 
            local tempX=-1 local tempY=-1
            limitTime=tonumber(limitTime) or 5--榛樿鏄?绉掗檺鍒?/span>
            while(true) do
               if (os.time()- startTime)>limitTime then
                    break
               end
                if type(tempTable[9])=="table" then
                    tempX, tempY = findMultiColorInRegionFuzzy(color, posandcolor, degree, x1, y1, x2, y2,tempTable[9])
                else
                    tempX, tempY = findMultiColorInRegionFuzzy(color, posandcolor, degree, x1, y1, x2, y2)
                end

                if tempX>-1  and tempY>-1  then
                else
                    break--鎵句笉鍒颁簡鎵嶈烦鍑?/span>
                end
                mSleep(100)
            end        
            if result==1  then
                traceprint("[绛夊緟澶氱偣鎵捐壊娑堝け] <" .. tostring(mark) .. "> 娑堝け澶辫触")                    
            else
                traceprint("[绛夊緟澶氱偣鎵捐壊娑堝け] [" .. tostring(mark) .. "] 娑堝け鎴愬姛 ")
            end
    
            --return result
        end,
        catch
            function (errors)
                --杩欓噷瀵瑰簲鍑芥暟鍚嶈鏀?/span>
                traceprint("鍑芥暟[" .. tostring("waitDdzsDisappear") .. "] <" .. tostring(tempTable[1] ) .. "> 閿欒淇℃伅锛?/span>".. tostring(errors))
            end            
        
    
end
--绛夊緟澶氱偣姣旇壊娑堝け
function waitDdbsDisappear(tempTable,limitTime)
    return try
        function ()
            --涓嬮潰浠g爜闅忎究鍐?鏈夊彲鑳芥姏鍑哄紓甯稿嵆鍙?/span>
            local result=-1
            local startTime=os.time()
            local mark=tempTable[1] 
            local tempArray=tempTable[2]
            local dim=tempTable[3] 
            local flag=tempTable[4] 
            local tempX=-1 local tempY=-1
            limitTime=tonumber(limitTime) or 5--榛樿鏄?绉掗檺鍒?/span>
            while(true) do
               if (os.time()- startTime)>limitTime then
                    break
               end
                if multiColor(tempArray,dim,flag) == true then                
                    tempX=tonumber( tempArray[1][1]) or -1
                    tempY=tonumber( tempArray[1][2]) or -1
                    if tempX==-1 or  tempY==-1 then
                        error("绗竴棰滆壊椤瑰潗鏍囧瓨鍦ㄩ棶棰?/span>")
                    else
                        result=1
                    end
                else
                    result=-1
                    break
                end            
                mSleep(100)
            end
            if result==1  then
                traceprint("[绛夊緟澶氱偣姣旇壊娑堝け] <" .. tostring(mark) .. "> 娑堝け澶辫触")                    
            else
                traceprint("[绛夊緟澶氱偣姣旇壊娑堝け] [" .. tostring(mark) .. "] 娑堝け鎴愬姛 ")
            end
            --return result
        end,
        catch
            function (errors)
                --杩欓噷瀵瑰簲鍑芥暟鍚嶈鏀?/span>
                traceprint("鍑芥暟[" .. tostring("waitDdbsDisappear") .. "] <" .. tostring(tempTable[1] ) .. "> 閿欒淇℃伅锛?/span>".. tostring(errors))
            end            
        
    
end
--绛夊緟鎵惧浘娑堝け
function waitZtDisappear(tempTable,limitTime)
    return try
        function ()
            --涓嬮潰浠g爜闅忎究鍐?鏈夊彲鑳芥姏鍑哄紓甯稿嵆鍙?/span>
            local result=-1
            local startTime=os.time()
            local mark=tempTable[1] 
            local picpath=tempTable[2]
            local degree=tempTable[3] 
            local x1=tempTable[4]  local y1=tempTable[5]  local x2=tempTable[6] local y2=tempTable[7] 
            local alpha=tempTable[8] or 0
            local tempType=tempTable[9]
            local tempX=-1 local tempY=-1
            limitTime=tonumber(limitTime) or 5--榛樿鏄?绉掗檺鍒?/span>
            
            while(true) do
               if (os.time()- startTime)>limitTime then
                    result=-1
                    break
               end
                if tempType==nil then
                    tempX, tempY = findImageInRegionFuzzy(picpath, degree, x1, y1, x2, y2, alpha)
                else
                    tempX, tempY = findImageInRegionFuzzy(picpath, degree, x1, y1, x2, y2, alpha,tempType)
                end
                if tempX>-1  and tempY>-1  then
                    result=1
                else
                    result=-1
                    break    
                end
                
                mSleep(100)
            end   
            
            
            if result==1  then
                traceprint("[绛夊緟鎵惧浘娑堝け] <" .. tostring(mark) .. "> 娑堝け澶辫触")                    
            else
                traceprint("[绛夊緟鎵惧浘娑堝け] [" .. tostring(mark) .. "] 娑堝け鎴愬姛 ")
            end
            --return result
        end,
        catch
            function (errors)
                --杩欓噷瀵瑰簲鍑芥暟鍚嶈鏀?/span>
                traceprint("鍑芥暟[" .. tostring("waitZtDisappear") .. "] <" .. tostring(tempTable[1] ) .. "> 閿欒淇℃伅锛?/span>".. tostring(errors))
            end            
        
        
end




闆跺熀纭€灏忕櫧瀛﹁Е鍔?- 08 - 濡備綍鍐欐洿鏅鸿兘鐨勬壘鑹茬偣鍑昏剼鏈?

灏忕煡璇嗭細鍙互鐩存帴杩炴帴鎵嬫満ip+绔彛 鐩存帴鍦ㄦ墜鏈?/strong>涓婂啓浠g爜

鎶€鏈浘鐗?  src=鎶€鏈浘鐗? width=?

浣嗘槸涓嶆帹鑽愯繖涓?/strong>鏂瑰紡 涓嶆垚鐔?娌℃湁鎰忎箟



鏈妭璇炬病浠€涔?鑰佸笀婕旂ず浜嗕笅 涓€涓敤澶氱偣鎵捐壊 瀹炵幇鎵剧瀛愮殑瀹炰緥


鐭ヨ瘑鐐癸細鍏充簬lua涓嬬殑閿欒澶勭悊鏈哄埗(鎰熻阿绱尗鎻掍欢鐨勬簮鐮佹彁渚涚殑閿欒澶勭悊鍑芥暟) 杩?涓嚱鏁版瀯寤轰簡鏁翠釜閿欒澶勭悊鏈哄埗 璁╄剼鏈嚱鏁板嚭閿欎笉鑷充簬鑴氭湰宕╂簝 骞朵笖鍙互鏃ュ織鎶ラ敊  涔嬪悗鎴戜滑鎵€鏈夊嚱鏁伴兘瑕佺被浼间笅闈㈢殑test11鐨勭粨鏋?闂寘褰㈠紡 鍜宼ry  catch 褰㈠紡

function traceprint(str)
    local info = debug.getinfo(2) 
    nLog("[" .. tostring(info["source"]) .. "]" .. "绗?/span>" .. tostring(info["currentline"]) .. "琛? " .. tostring(str))
    --nLog("[" .. string.format("%s:%d:", info["source"]:match(".*\\([^\\]*)")) .. "]" .. "绗? .. tostring(info["currentline"]) .. "琛? " .. tostring(str))    
    mSleep(5)--涓轰簡nLog鐨勬樉绀洪『搴忕殑鏆傛椂瑙e喅鍔炴硶
end
function try(block)
    local tablejoin = function (...)
        local result = 
        for _, t in ipairs(...) do
            if type(t) == "table" then
                for k, v in pairs(t) do
                    if type(k) == "number" then table.insert(result, v)
                    else result[k] = v end
                end
            else
                table.insert(result, t)
            end
        end
        return result
    end
 
    -- get the try function
    local try = block[1]
    assert(try)
     
    -- get catch and finally functions
    local funcs = tablejoin(block[2] or , block[3] or )
     
    -- try to call it
    local result_error = 
    local results = pcall(try)
    if not results[1] then
        -- run the catch function
        if funcs and funcs.catch then
            result_error = funcs.catch(results[2])
        end
    end
 
    -- run the finally function
    if funcs and funcs.finally then
        local result_fin = funcs.finally(table.unpack(results))
        if #result_fin > 0 then
            return table.unpack(result_fin)
        end
    end
 
    -- ok?
    if results[1] and #results > 1 then
        return table.unpack(results, 2, #results)
    else
        if #result_error > 0 then
            return table.unpack(result_error)
        else
            return nil
        end
    end
end
function catch(block)
    -- get the catch block function
    return catch = block[1]
end
function finally(block)
    -- get the finally block function
    return finally = block[1]
end
--鍑洪敊鍑芥暟 杩欑缁撴瀯灏辨槸鎴戜滑鐨勬瘡涓嚱鏁扮殑鍩烘湰缁撴瀯 鍥犱负杩欐牱鐨勭粨鏋勫彲浠ヤ繚璇佸氨绠楀嚱鏁板嚭閿欎簡 鑴氭湰涔熶笉浼氬穿婧冨悓鏃惰繖涔熸槸闂寘缁撴瀯
function test11(a)
    return    try
            function ()
                if a==1 then
                    error("error a==1")--鎶涘嚭寮傚父
                else
                    --error("error a~=1")
                    return a
                end                
            end,--娉ㄦ剰杩欐湁閫楀彿
            --鎹曡幏寮傚父
            catch
                function (errors)
                    traceprint("test11 鍙戠敓杩愯鏃堕敊璇紒閿欒淇℃伅锛?/span>".. tostring(errors))
                end
            
        

end


--杩欓噷蹇呯劧鍑洪敊 浣嗘槸鑴氭湰娌℃湁宕╂簝 琚敊璇嚱鏁板鐞嗗畬姣曚簡 鍚庨潰鐨勪唬鐮佷緷鐒舵甯告墽琛?/span>
traceprint(test11(1))--[main.lua]绗?5琛? test11 鍙戠敓杩愯鏃堕敊璇紒閿欒淇℃伅锛歔string "main.lua"]:35: error a==1
traceprint("1111111111")--[main.lua]绗?7琛? 1111111111

以上是关于[瑙﹀姩绮剧伒]闆跺熀纭€灏忕櫧瀛﹁Е鍔?-8的主要内容,如果未能解决你的问题,请参考以下文章

闆跺熀纭€瀛eb鍓嶇璺嚎锛岄€佺粰鎵€鏈夋兂瀛eb鍓嶇鐨勪汉

闆跺熀纭€瀛ginx銆?銆憒 Nginx 甯哥敤鐨勫懡浠ゅ拰閰嶇疆鏂囦欢

Java灏忕櫧闆嗗悎婧愮爜鐨勫涔犵郴鍒楋細Vector

娣卞害瑙f瀽jQuery涓嶢jax鐨勫師鐞嗭紝灏忕櫧閮藉彲浠ョ湅寰楁噦锛岀畝鍗曟槗鎳傦紒锛?/h1>

(c)2006-2024 SYSTEM All Rights Reserved IT常识