function check_status()
local l= wait.regexp("You are dead", 5)
if l==nil then
print('Timeout')
return 1
else
print('Triggered')
return 0
end --if
end --function
co=coroutine.create(check_status)
local x,y=coroutine.resume(co)
if y==1 then
print('You are still alive')
end
if y==0 then
print('You are absolutly dead')
end
if y==nil then
print('Nothing returned')
end
-------------------Code-----------------------------
It always printed 'Nothing returned' and seems to skip over the process of 'check_status' called by coroutine
How can I get the return value firstly and then go do something else?
Best regards.
local l= wait.regexp("You are dead", 5)
if l==nil then
print('Timeout')
return 1
else
print('Triggered')
return 0
end --if
end --function
co=coroutine.create(check_status)
local x,y=coroutine.resume(co)
if y==1 then
print('You are still alive')
end
if y==0 then
print('You are absolutly dead')
end
if y==nil then
print('Nothing returned')
end
-------------------Code-----------------------------
It always printed 'Nothing returned' and seems to skip over the process of 'check_status' called by coroutine
How can I get the return value firstly and then go do something else?
Best regards.