Fix. Test for Lua > 5.1

master
Alexey Melnichuk 2016-09-27 18:20:34 +03:00
parent e7f83e7aa6
commit a836734bfc
1 changed files with 8 additions and 1 deletions

View File

@ -2,10 +2,17 @@ local curl = require "lcurl"
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()
called = called + 1
-- 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
local function test_1()