cleaned minetest.register_globalstep()
This commit is contained in:
parent
04cf7b139e
commit
b532d5ca28
4
init.lua
4
init.lua
|
@ -168,16 +168,13 @@ function MatrixChat:get_access_url()
|
|||
print(u)
|
||||
end
|
||||
|
||||
-- local SECONDS = 0
|
||||
local INTERVAL = 60
|
||||
local HANDLE = nil
|
||||
minetest.register_globalstep(function(dtime)
|
||||
-- SECONDS = SECONDS + dtime
|
||||
if HANDLE == nil then
|
||||
local request = MatrixChat:get_sync_table(INTERVAL * 1000)
|
||||
request.timeout = INTERVAL
|
||||
HANDLE = http.fetch_async(request)
|
||||
-- SECONDS = 0 -- reset
|
||||
elseif HANDLE ~= nil then
|
||||
local result = http.fetch_async_get(HANDLE)
|
||||
if result.completed then
|
||||
|
@ -191,7 +188,6 @@ minetest.register_globalstep(function(dtime)
|
|||
elseif result.code == 404 then
|
||||
end
|
||||
HANDLE = nil
|
||||
-- SECONDS = 0 -- reset
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
|
Loading…
Reference in New Issue