diff options
author | rubidium <rubidium@openttd.org> | 2014-09-19 20:06:51 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2014-09-19 20:06:51 +0000 |
commit | 79ca66eb673c710432d1f4e51af70730a09a82c8 (patch) | |
tree | 5c26b5456711549c69e6d7c74b6e966072670cb6 /src/3rdparty/squirrel/samples/metamethods.nut | |
parent | bd0cd31d4b4e13dcf99c3b4170069d9eb08a91cf (diff) | |
download | openttd-79ca66eb673c710432d1f4e51af70730a09a82c8.tar.xz |
(svn r26853) -Cleanup [Squirrel]: remove some stuff that we never did and especially never should use
Diffstat (limited to 'src/3rdparty/squirrel/samples/metamethods.nut')
-rw-r--r-- | src/3rdparty/squirrel/samples/metamethods.nut | 115 |
1 files changed, 0 insertions, 115 deletions
diff --git a/src/3rdparty/squirrel/samples/metamethods.nut b/src/3rdparty/squirrel/samples/metamethods.nut deleted file mode 100644 index 53439520e..000000000 --- a/src/3rdparty/squirrel/samples/metamethods.nut +++ /dev/null @@ -1,115 +0,0 @@ - -local base_vec={ - function _add(n) - { - return { - x=x+n.x, - y=y+n.y, - z=z+n.z, - } - } - function _sub(n) - { - return { - x=x-n.x, - y=y-n.y, - z=z-n.z, - } - } - function _div(n) - { - return { - x=x/n.x, - y=y/n.y, - z=z/n.z, - } - } - function _mul(n) - { - return { - x=x*n.x, - y=y*n.y, - z=z*n.z, - } - } - function _modulo(n) - { - return { - x=x%n, - y=y%n, - z=z%n, - } - } - function _typeof() {return "vector";} - function _get(key) - { - if(key==100) - { - return test_field; - } - }, - function _set(key,val) - { - ::print("key = "+key+"\n"); - ::print("val = "+val+"\n") - if(key==100) - { - return test_field=val; - } - } - test_field="nothing" -} - -function vector(_x,_y,_z):(base_vec) -{ - return delegate base_vec : {x=_x,y=_y,z=_z } -} -//////////////////////////////////////////////////////////// - -local v1=vector(1.5,2.5,3.5); -local v2=vector(1.5,2.5,3.5); - -local r=v1+v2; - - -foreach(i,val in r) -{ - print(i+" = "+val+"\n"); -} - -r=v1*v2; - -foreach(i,val in r) -{ - print(i+" = "+val+"\n"); -} - -r=v1/v2; - -foreach(i,val in r) -{ - print(i+" = "+val+"\n"); -} - -r=v1-v2; - -foreach(i,val in r) -{ - print(i+" = "+val+"\n"); -} - -r=v1%2; - -foreach(i,val in r) -{ - print(i+" = "+val+"\n"); -} - -print(v1[100]+"\n"); -v1[100]="set SUCCEEDED"; -print(v1[100]+"\n"); - -if(typeof v1=="vector") - print("<SUCCEEDED>\n"); -else - print("<FAILED>\n"); |