Fix. Test for Lua > 5.1
This commit is contained in:
parent
e7f83e7aa6
commit
a836734bfc
@ -2,10 +2,17 @@ local curl = require "lcurl"
|
|||||||
|
|
||||||
local called, active_coroutine = 0
|
local called, active_coroutine = 0
|
||||||
|
|
||||||
|
-- for Lua 5.1 compat
|
||||||
|
local function co_running()
|
||||||
|
local co, main = coroutine.running()
|
||||||
|
if main == true then return nil end
|
||||||
|
return co
|
||||||
|
end
|
||||||
|
|
||||||
function on_timer()
|
function on_timer()
|
||||||
called = called + 1
|
called = called + 1
|
||||||
-- use `os.exit` because now Lua-cURL did not propogate error from callback
|
-- use `os.exit` because now Lua-cURL did not propogate error from callback
|
||||||
if coroutine.running() ~= active_coroutine then os.exit(-1) end
|
if co_running() ~= active_coroutine then os.exit(-1) end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function test_1()
|
local function test_1()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user