mirror of
https://github.com/love2d/love.git
synced 2026-08-18 11:44:15 +02:00
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:
@@ -72,6 +72,8 @@ local ffifuncs = ffi.cast("FFI_RandomGenerator *", ffifuncspointer)
|
||||
-- Overwrite some regular love.math functions with FFI implementations.
|
||||
|
||||
function RandomGenerator:random(l, u)
|
||||
-- TODO: This should ideally be handled inside ffifuncs.random
|
||||
if self == nil then error("bad argument #1 to 'random' (RandomGenerator expected, got no value)", 2) end
|
||||
local r = tonumber(ffifuncs.random(self))
|
||||
return getrandom(r, l, u)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user