co=coroutine.create(
function (str)
return str
end)
print(coroutine.resume(co,"hello world"))
Although the above code can show "true hello world",I can not
obtain the return value when I typed
"local x=coroutine.resume(co,"hello world") print(x)"
and Var 'x' is just printed "true".
How should I gain the return value from coroutine just like normal function?
I know using Globle variable is also a solution ,but I don't like to do it because I want to keep concision in code.
I appreciate if someone can show me a way.
function (str)
return str
end)
print(coroutine.resume(co,"hello world"))
Although the above code can show "true hello world",I can not
obtain the return value when I typed
"local x=coroutine.resume(co,"hello world") print(x)"
and Var 'x' is just printed "true".
How should I gain the return value from coroutine just like normal function?
I know using Globle variable is also a solution ,but I don't like to do it because I want to keep concision in code.
I appreciate if someone can show me a way.