I can’t seem to find the answer to this. The question is simple, how do I call a function with pcall while also using coroutine.wrap?
local function coolFunction()
local success, errormsg = pcall(function()
end)
if success then
return "good function"
end
end
local betterfunction = coroutine.wrap(coolFunction)
print(betterfunction())
or if you mean other thing:
local function yourFunction()
print("haha very funni")
return "yes"
end
local success, returnedOrError = pcall(function()
local NewFunction = coroutine.wrap(yourFunction)
return NewFunction()
end)
if returnedOrError == "yes" then
print("It works")
end