So what I've been doing is this, but it seams stupid to put a function inside a function, is there a way I can combine the name with the corotine with being able to call the function at any time I want to?
local message=function(text) coroutine.resume(coroutine.create(function() guiFrame.Msg.Text=text wait(.15) guiFrame.Msg.Text='' end)) end
function funcName(params) --code end
Is just syntactic sugar for.
funcName = function(params) --code end
There isn't a way to just bind a coroutine to a re-usable function that I know of, but if you want to pass in the parameter to the coroutine function, do this:
local message=function(text) coroutine.resume(coroutine.create(function(txt) --parameter in inner function guiFrame.Msg.Text = txt --parameter in inner function wait(.15) guiFrame.Msg.Text = "" end), text) --parameter *from* outer function. Note the parentheses placement. end