| 1 |
/* |
| 2 |
http://www.squirrel-lang.org/ |
| 3 |
*/ |
| 4 |
local table = { |
| 5 |
a = "10" |
| 6 |
subtable = { |
| 7 |
array = [1,2,3] |
| 8 |
}, |
| 9 |
[10 + 123] = "expression index" |
| 10 |
} |
| 11 |
|
| 12 |
local array=[ 1, 2, 3, { a = 10, b = "string" } ]; |
| 13 |
|
| 14 |
foreach (i,val in array) |
| 15 |
{ |
| 16 |
::print("the type of val is"+typeof val); |
| 17 |
} |
| 18 |
|
| 19 |
///////////////////////////////////////////// |
| 20 |
|
| 21 |
class Entity |
| 22 |
{ |
| 23 |
constructor(etype,entityname) |
| 24 |
{ |
| 25 |
name = entityname; |
| 26 |
type = etype; |
| 27 |
} |
| 28 |
|
| 29 |
x = 0; |
| 30 |
y = 0; |
| 31 |
z = 0; |
| 32 |
name = null; |
| 33 |
type = null; |
| 34 |
} |
| 35 |
|
| 36 |
function Entity::MoveTo(newx,newy,newz) |
| 37 |
{ |
| 38 |
x = newx; |
| 39 |
y = newy; |
| 40 |
z = newz; |
| 41 |
} |