Added Object:release. Calling it is the equivalent of removing all Lua-side references to an object and doing a full garbage collection cycle (thus deleting the object from memory if nothing else in LÖVE's code is referencing it).

Any attempt to call a method on the object after it has been released will result in an error. Object:release() returns true if it was successful, or false if not (if it has already been released previously).

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2016-10-06 21:59:01 -03:00
parent bfb00239fd
commit 37520bd18b
7 changed files with 69 additions and 9 deletions
+1 -1
View File
@@ -126,7 +126,7 @@ static FFI_RandomGenerator ffifuncs =
[](Proxy *p) -> double // random()
{
// FIXME: We need better type-checking...
if (p == nullptr || !typeFlags[p->type][MATH_RANDOM_GENERATOR_ID])
if (p == nullptr || p->object == nullptr || !typeFlags[p->type][MATH_RANDOM_GENERATOR_ID])
return 0.0;
RandomGenerator *rng = (RandomGenerator *) p->object;