Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

Author Topic: 2d Array  (Read 2678 times)

0 Members and 1 Guest are viewing this topic.

mamajo

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 2
    • View Profile
2d Array
« on: December 28, 2011, 01:30:17 PM »

Hello
I used to take 2D Array, but I do not know how to quote them.
In C++ are to be announced , But how Wintermute ?

Code: [Select]

//Arrayname [Row subscript][Column subscript]

int MyArray[2][3] = {{1,2,3} , {4,5,6}};


Thank you.  :)
Logged

eborr

  • Regular poster
  • ***
  • Karma: 4
  • Offline Offline
  • Posts: 196
    • View Profile
Re: 2d Array
« Reply #1 on: December 28, 2011, 02:06:11 PM »

To initiate an array and populate it

Code: [Select]
var songs = new Array("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17");

For an empty array

Code: [Select]
var already_played = new Array();
« Last Edit: December 28, 2011, 02:09:22 PM by eborr »
Logged

mamajo

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 2
    • View Profile
Re: 2d Array
« Reply #2 on: December 28, 2011, 02:49:43 PM »

thanks  :)
This is an array that defines you  , 1D.
 How do we define the 2D Array?
Logged

Spellbreaker

  • Supporter
  • Frequent poster
  • *
  • Karma: 4
  • Offline Offline
  • Gender: Male
  • Posts: 376
    • View Profile
    • Apeiron Studios
Re: 2d Array
« Reply #3 on: December 28, 2011, 03:08:17 PM »

There's no 2D Array in WME. But:

Quote from: metamorphium
you can do this easily with dll (in c++) but 2d arrays is not a real limitation. If you need matrix of any rowsize, you can easily use this 2d to 1d conversion:

2darray[1][2] == 1darray[1*rowsize + 2]

(zero indexed of course)
Logged
 

Page created in 0.021 seconds with 24 queries.