Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
32b7b3e
commit 85840aa
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
//example from http://www.squirrel-lang.org/#documentation | ||
|
||
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); |