Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local MT = {}
- function MT:__gc()
- self.cnt = self.cnt + 1
- if self.cnt == 1 then
- print("finalizing...")
- else
- print("and again...")
- end
- setmetatable(self, MT) -- here the error occurs
- end
- do
- local Collectable = {cnt = 0}
- setmetatable(Collectable, MT)
- end
- collectgarbage()
- collectgarbage()
- collectgarbage()
- collectgarbage()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement