diff options
author | rubidium <rubidium@openttd.org> | 2009-02-25 01:21:50 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-02-25 01:21:50 +0000 |
commit | 1ad50ce4e6ed74c8eeb89a1f2780e6ed58a72b2b (patch) | |
tree | 0955433146cc59335ddaac1d6e08eb177a9ead61 /src/3rdparty/squirrel/samples/classattributes.nut | |
parent | 66a8c0a1325e1f8717150dc6bbe1bcb4fb458bef (diff) | |
download | openttd-1ad50ce4e6ed74c8eeb89a1f2780e6ed58a72b2b.tar.xz |
(svn r15578) -Change: unexternalise squirrel.
Diffstat (limited to 'src/3rdparty/squirrel/samples/classattributes.nut')
-rw-r--r-- | src/3rdparty/squirrel/samples/classattributes.nut | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/3rdparty/squirrel/samples/classattributes.nut b/src/3rdparty/squirrel/samples/classattributes.nut new file mode 100644 index 000000000..01232002c --- /dev/null +++ b/src/3rdparty/squirrel/samples/classattributes.nut @@ -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") + } +} |