Add ThreadNode update handler

master
informatic 2017-02-24 01:50:40 +01:00
parent 9c8d2432e7
commit bf68bc224d
1 changed files with 8 additions and 1 deletions

View File

@ -21,7 +21,10 @@ function ThreadNode:checkUpdate()
updateThread:start()
end
self.state = love.thread.getChannel(self.threadChannel):pop() or self.state
local v = love.thread.getChannel(self.threadChannel):pop()
if v then
self:onUpdate(v)
end
end
end
@ -30,4 +33,8 @@ function ThreadNode:afterExit()
self:checkUpdate()
end
function ThreadNode:onUpdate(v)
self.state = v
end
return ThreadNode