Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 0.98 KB | None | 0 0
  1. function ArrayCleanup(a) {
  2.     foreach (i, v in a) {
  3.         switch (typeof(v)) {
  4.             case "null":
  5.             case "integer":
  6.             case "float":
  7.             case "string":
  8.             case "function": break;
  9.             case "class": TableCleanup(v); break;
  10.             case "table": TableCleanup(v); break;
  11.             case "array": ArrayCleanup(v); break;
  12.             default: t.rawset(k, null); break;
  13.         }
  14.     }
  15. }
  16. function TableCleanup(t) {
  17.     foreach (k, v in t) {
  18.         switch (typeof(v)) {
  19.             case "null":
  20.             case "integer":
  21.             case "float":
  22.             case "string":
  23.             case "function": break;
  24.             case "class": TableCleanup(v); break;
  25.             case "table": TableCleanup(v); break;
  26.             case "array": ArrayCleanup(v); break;
  27.             default: t.rawset(k, null); break;
  28.         }
  29.     }
  30. }
  31. // Start with the root table
  32. TableCleanup(getroottable());
  33. // Who knows :/
  34. collectgarbage();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement