Skip to content

Commit

Permalink
- Add log
Browse files Browse the repository at this point in the history
  • Loading branch information
ParticleG committed Nov 1, 2024
1 parent 017f874 commit 77fd519
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
8 changes: 7 additions & 1 deletion Zframework/clipboard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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={}

Expand All @@ -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
2 changes: 2 additions & 0 deletions Zframework/clipboard_thread.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
18 changes: 6 additions & 12 deletions Zframework/js.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
__requestQueue = {}
_requestCount = 0
_Request =
local __requestQueue = {}
local _requestCount = 0
local _Request =
{
command = "",
currentTime = 0,
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 77fd519

Please sign in to comment.