From 77fd519b4375487e90486349c9dfb064b73fc8a8 Mon Sep 17 00:00:00 2001 From: ParticleG Date: Fri, 1 Nov 2024 08:48:25 +0800 Subject: [PATCH] - Add log --- Zframework/clipboard.lua | 8 +++++++- Zframework/clipboard_thread.lua | 2 ++ Zframework/js.lua | 18 ++++++------------ 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Zframework/clipboard.lua b/Zframework/clipboard.lua index 3b0b2be8..e97f489c 100644 --- a/Zframework/clipboard.lua +++ b/Zframework/clipboard.lua @@ -31,7 +31,7 @@ local getCHN=love.thread.newChannel() local setCHN=love.thread.newChannel() local triggerCHN=love.thread.newChannel() -clipboard_thread:start(getCHN,setCHN,triggerCHN) +TASK.new(function() TEST.yieldN(26); print("1"); clipboard_thread:start(getCHN,setCHN,triggerCHN) end) local clipboard={} @@ -45,6 +45,12 @@ end function clipboard._update() triggerCHN:push(0) + local error = clipboard_thread:getError() + if error then + MES.new('error',error) + MES.traceback() + clipboard._update=NULL + end end return clipboard \ No newline at end of file diff --git a/Zframework/clipboard_thread.lua b/Zframework/clipboard_thread.lua index eace600d..a6380b9f 100644 --- a/Zframework/clipboard_thread.lua +++ b/Zframework/clipboard_thread.lua @@ -3,7 +3,9 @@ local getCHN,setCHN,triggerCHN=... local CHN_demand,CHN_getCount=triggerCHN.demand,triggerCHN.getCount local CHN_push,CHN_pop=triggerCHN.push,triggerCHN.pop +print("2"); JS=require'Zframework.js' +print("3"); local yield=coroutine.yield local setThread=coroutine.wrap(function() diff --git a/Zframework/js.lua b/Zframework/js.lua index f353eb46..6867d532 100644 --- a/Zframework/js.lua +++ b/Zframework/js.lua @@ -1,6 +1,6 @@ -__requestQueue = {} -_requestCount = 0 -_Request = +local __requestQueue = {} +local _requestCount = 0 +local _Request = { command = "", currentTime = 0, @@ -11,10 +11,10 @@ local os = love.system.getOS() local __defaultErrorFunction = nil local isDebugActive = false -JS = {} +local JS = {} function JS.callJS(funcToCall) - if(os == "Web") then + if os == "Web" then print("callJavascriptFunction " .. funcToCall) end end @@ -23,16 +23,10 @@ end --If you pass arguments to the func beyond the string, it will perform automatically string.format --Return statement is possible inside this structure --This will return a string containing a function to be called by JS.callJS -local _unpack -if(_VERSION == "Lua 5.1" or _VERSION == "LuaJIT") then - _unpack = unpack -else - _unpack = table.unpack -end function JS.stringFunc(str, ...) str = "(function(){"..str.."})()" if(#arg > 0) then - str = str:format(_unpack(arg)) + str = str:format(unpack(arg)) end str = str:gsub("[\n\t]", "") return str