CapsAdmin

Untitled

Sep 27th, 2013
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.53 KB | None | 0 0
  1. local finalizers = setmetatable({}, {__mode = "k"})
  2.  
  3. function utilities.SetGCCallback(t, func)
  4.     local ud = newproxy(true)
  5.     debug.getmetatable(ud).__gc = function () return func(t) end
  6.  
  7.     finalizers[t] = ud  
  8.  
  9.     return t
  10. end
  11.  
  12. local time = glfw.GetTime()
  13.  
  14. local LOL = {}
  15. collectgarbage("collect")
  16. collectgarbage("collect")
  17. collectgarbage("collect")
  18. collectgarbage("collect")
  19. collectgarbage("collect")
  20. collectgarbage("collect")
  21. utilities.SetGCCallback(LOL, function() print("LOL") print(glfw.GetTime()-time) end)
Advertisement
Add Comment
Please, Sign In to add comment