Files @ r20718:cc912091a170
Branch filter:

Location: cpp/openttd-patchpack/source/src/3rdparty/squirrel/samples/metamethods.nut - annotation

translators
(svn r25756) -Update from WebTranslator v3.0:
indonesian - 2 changes by UseYourIllusion
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7
r11225:37853e3b55c7

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");