Hash :
fd1081d2
Author :
Date :
2021-01-29T15:01:24
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
<h2>Full example</h2>
<pre><code> // source: http://www.squirrel-lang.org/#look
local table = {
a = "10"
subtable = {
array = [1,2,3]
},
[10 + 123] = "expression index"
}
local array=[ 1, 2, 3, { a = 10, b = "string" } ];
foreach (i,val in array)
{
::print("the type of val is"+typeof val);
}
/////////////////////////////////////////////
class Entity
{
constructor(etype,entityname)
{
name = entityname;
type = etype;
}
x = 0;
y = 0;
z = 0;
name = null;
type = null;
}
function Entity::MoveTo(newx,newy,newz)
{
x = newx;
y = newy;
z = newz;
}
class Player extends Entity {
constructor(entityname)
{
base.constructor("Player",entityname)
}
function DoDomething()
{
::print("something");
}
}
local newplayer = Player("da playar");
newplayer.MoveTo(100,200,300);</code></pre>