How to override luabind class __finalize method?
Trying to do this in such way:
class A
function A:__init()
end
function A:__finalize()
end
local original_finalize_function = A.__finalize
A.__finalize = function(...)
-- some custom logic
if original_finalize_function then
original_finalize_function(unpack(arg))
end
end
local a = A
a = nil
collectgarbage('collect')
But lua still calls only original finalizer. It does work for __init method however:
local original_init_function = A.__init
A.__init = function(...)
if original_init_function then
original_init_function(unpack(arg))
end
end
Also I've tried to override getmetatable(A).__finilize. Doesn't help too.
How can I override it? Thanks in advance.