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)
|
print(u)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- local SECONDS = 0
|
|
||||||
local INTERVAL = 60
|
local INTERVAL = 60
|
||||||
local HANDLE = nil
|
local HANDLE = nil
|
||||||
minetest.register_globalstep(function(dtime)
|
minetest.register_globalstep(function(dtime)
|
||||||
-- SECONDS = SECONDS + dtime
|
|
||||||
if HANDLE == nil then
|
if HANDLE == nil then
|
||||||
local request = MatrixChat:get_sync_table(INTERVAL * 1000)
|
local request = MatrixChat:get_sync_table(INTERVAL * 1000)
|
||||||
request.timeout = INTERVAL
|
request.timeout = INTERVAL
|
||||||
HANDLE = http.fetch_async(request)
|
HANDLE = http.fetch_async(request)
|
||||||
-- SECONDS = 0 -- reset
|
|
||||||
elseif HANDLE ~= nil then
|
elseif HANDLE ~= nil then
|
||||||
local result = http.fetch_async_get(HANDLE)
|
local result = http.fetch_async_get(HANDLE)
|
||||||
if result.completed then
|
if result.completed then
|
||||||
|
@ -191,7 +188,6 @@ minetest.register_globalstep(function(dtime)
|
||||||
elseif result.code == 404 then
|
elseif result.code == 404 then
|
||||||
end
|
end
|
||||||
HANDLE = nil
|
HANDLE = nil
|
||||||
-- SECONDS = 0 -- reset
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
Loading…
Reference in New Issue