I would like to create a table of coroutines using functions from a module so that I can close/yield anytime I want:
local gameUI = require(script.GameUI)
module.SaveCoroutine = function(functionName,...)
if module.Coroutines[functionName] then
coroutine.close(module.Coroutines[functionName])
end
module.Coroutines[functionName] = gameUI[functionName]
module.Coroutines[functionName](...)
end
module.EndGame = function()
print(module.Coroutines)
for _, fnction in pairs(module.Coroutines) do
coroutine.close(fnction)
end
end
An example of a function in that specific module
module.GameStart = coroutine.wrap(function(...)
If I print the module, all values come out as “function” in string format.