test-weakref.nut 393 B

123456789101112131415161718
  1. class A {}
  2. local instA = A();
  3. print(instA);
  4. local weakv = instA.weakref();
  5. print(weakv);
  6. local instBlob = blob();
  7. print(instBlob);
  8. weakv = instBlob.weakref();
  9. print(weakv);
  10. local t = {}
  11. local a = ["first","second","third"]
  12. //creates a weakref to the array and assigns it to a table slot
  13. t.thearray <- a.weakref();
  14. print(t.thearray[0]);
  15. a = 123;
  16. ::print(typeof(t.thearray))