classattributes.nut 591 B

1234567891011121314151617181920212223242526272829303132333435
  1. class Foo {
  2. //constructor
  3. constructor(a)
  4. {
  5. testy = ["stuff",1,2,3];
  6. }
  7. //attributes of PrintTesty
  8. </ test = "freakin attribute"/>
  9. function PrintTesty()
  10. {
  11. foreach(i,val in testy)
  12. {
  13. ::print("idx = "+i+" = "+val+" \n");
  14. }
  15. }
  16. //attributes of testy
  17. </ flippy = 10 , second = [1,2,3] />
  18. testy = null;
  19. }
  20. foreach(member,val in Foo)
  21. {
  22. ::print(member+"\n");
  23. local attr;
  24. if((attr = Foo.getattributes(member)) != null) {
  25. foreach(i,v in attr)
  26. {
  27. ::print("\t"+i+" = "+(typeof v)+"\n");
  28. }
  29. }
  30. else {
  31. ::print("\t<no attributes>\n")
  32. }
  33. }