Skip to content

Instantly share code, notes, and snippets.

@kn666
Forked from Mons/super-gc.lua
Created May 4, 2018 07:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kn666/fa383c74e9cc43a88f1530c4c6ead362 to your computer and use it in GitHub Desktop.
Save kn666/fa383c74e9cc43a88f1530c4c6ead362 to your computer and use it in GitHub Desktop.
Class, super and gc
local weak = setmetatable({},{__mode = 'v'})
do
local Class = {}
-- function Class:super( class,method )
-- return function ()
-- print("work")
-- end
-- end
function Class:test()
self:super(Class,'method')()
end
weak.Class = Class
-- local o = setmetatable({},{__index = Class})
-- o:test()
end
collectgarbage('collect')
print(weak.Class)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment