The Squirrel interpreter. See http://www.squirrel-lang.org/
samples/classattributes.nut
- Committer:
- jhnwkmn
- Date:
- 2014-12-16
- Revision:
- 3:7268a3ceaffc
- Parent:
- 0:97a4f8cc534c
File content as of revision 3:7268a3ceaffc:
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") } }