|
that's my understanding as well.
I was thinking that the problem could be that since functions are first
class values, having the function defined in a module like the
"coroutine_update" in the snippet actually means keeping a reference to that
function.
Now when I run coroutine.create(coroutine_update) i am actually adding a
reference to the same function through the coroutine so even if the
coroutine is collected the function will still be referenced through the
"coroutine_update" variable in the module, therefore the local userdata will
never be garbage collected.
But i am not sure if the way i think function values are referenced is
correct, maybe they are "instanced" when referenced by coroutines?
If someone could shred some light on this it would be great.