The Squirrel interpreter. See http://www.squirrel-lang.org/
Diff: samples/classattributes.nut
- Revision:
- 0:97a4f8cc534c
diff -r 000000000000 -r 97a4f8cc534c samples/classattributes.nut --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/classattributes.nut Tue Dec 16 10:20:34 2014 +0000 @@ -0,0 +1,35 @@ +class Foo { + //constructor + constructor(a) + { + testy = ["stuff",1,2,3]; + } + //attributes of PrintTesty + </ test = "freakin attribute"/> + function PrintTesty() + { + foreach(i,val in testy) + { + ::print("idx = "+i+" = "+val+" \n"); + } + } + //attributes of testy + </ flippy = 10 , second = [1,2,3] /> + testy = null; + +} + +foreach(member,val in Foo) +{ + ::print(member+"\n"); + local attr; + if((attr = Foo.getattributes(member)) != null) { + foreach(i,v in attr) + { + ::print("\t"+i+" = "+(typeof v)+"\n"); + } + } + else { + ::print("\t<no attributes>\n") + } +} \ No newline at end of file