[THYME]Arrays

About advanced scenes, and the Thyme scripting language used in Algodoo.

[THYME]Arrays

Postby ags131 » Wed Jan 13, 2010 9:55 pm

I have discovered something interesting in algodoo.
Arrays can be embedded!

Example:
row1=[[1,1,1,1],[1,0,0,1]]
row2=[[0,0,0,1],[1,1,0,1]]
screen=[row1,row2]
or
screen=[[[1,1,1,1],[1,0,0,1]],[[0,0,0,1],[1,1,0,1]]]

Results:
screen(0)=[[1,1,1,1],[1,0,0,1]]
screen(1)=[[0,0,0,1],[1,1,0,1]]

screen(0)(0)=[1,1,1,1]
screen(0)(1)=[1,0,0,1]
screen(1)(0)=[0,0,0,1]
screen(1)(1)=[1,1,0,1]

screen(1)(0)(1)=0
screen(1)(0)(3)=1

I discovered this while playing in the console and though i would share the knowledge as i havent ever seen arrays like this before.
ags131
 
Posts: 71
Joined: Thu Oct 29, 2009 4:14 pm

Re: [THYME]Arrays

Postby Kilinich » Wed Jan 13, 2010 9:58 pm

we know :mrgreen:
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: [THYME]Arrays

Postby ags131 » Wed Jan 13, 2010 10:19 pm

:P Ive never seen it posted before though.
ags131
 
Posts: 71
Joined: Thu Oct 29, 2009 4:14 pm

Re: [THYME]Arrays

Postby KarateBrot » Wed Jan 13, 2010 11:50 pm

You can even embed embedded arrays. or you could embed embedded embedded arrays :D
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany

Re: [THYME]Arrays

Postby legophunpp » Thu Jan 14, 2010 1:43 am

what is an Array?
legophunpp
 
Posts: 12
Joined: Tue Jan 12, 2010 1:26 am

Re: [THYME]Arrays

Postby standardtoaster » Thu Jan 14, 2010 2:17 am

An array is a list. Instead of having multiple variables you could use one as an array.
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: [THYME]Arrays

Postby isaacwaller » Thu Jan 14, 2010 4:08 am

The name for this is multi-dimensional arrays.
--
Isaac Waller
Developer
Sirius Applications
http://www.siriusapplications.com/
isaacwaller
 
Posts: 9
Joined: Fri Dec 25, 2009 12:11 am
Location: Canada


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 3 guests