Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
4 registered members (TipmyPip, AndrewAMD, dBc, clonman), 18,621 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
how do you initialize a multi-dimensional array? #147736
08/13/07 20:30
08/13/07 20:30
Joined: Mar 2007
Posts: 197
Y
yorisimo Offline OP
Member
yorisimo  Offline OP
Member
Y

Joined: Mar 2007
Posts: 197
In the manual it says to initialize an array:
var name[n] = { value_1, value_2, ... value_n };

but what about a multidimensional array?
As an example, I've tried both:

var array[2][2] = {1, 2 ,3, 4};

and

var array[2][2] = {{1, 2},{3,4}};

which is how it's done in C, but neither compiles (syntax error) in Lite_C.
Any ideas?

Re: how do you initialize a multi-dimensional arr [Re: yorisimo] #147737
08/15/07 14:09
08/15/07 14:09
Joined: Mar 2007
Posts: 197
Y
yorisimo Offline OP
Member
yorisimo  Offline OP
Member
Y

Joined: Mar 2007
Posts: 197
Has no one done this?!


Joris Lambrecht
My Contributions: Relative Rotation, Window Sizing
Re: how do you initialize a multi-dimensional arr [Re: yorisimo] #147738
08/15/07 15:13
08/15/07 15:13
Joined: Apr 2005
Posts: 67
InnerSpace
dudeBot Offline
Junior Member
dudeBot  Offline
Junior Member

Joined: Apr 2005
Posts: 67
InnerSpace
I'm not sure about liteC, but I do know that cScript
does not allow mutli-dimensional arrays.

check this post out:
http://www.coniserver.net/ubbthreads/showflat.php/Cat/0/Number/776842/an/0/page/0#Post776842

You may already know this stuff, but this thread talks about
how to manage a singe dimensional array as if it a mutli-dimensional array.

If you don't know this stuff, check out my last post in the thread.
It has a link to some cScript with funcitons created to initialize
the array, as well error-checking "get" and "set" functions.

I think that it should be little effort if any, to "port" the cScript
over to liteC.

Re: how do you initialize a multi-dimensional arr [Re: yorisimo] #147739
08/15/07 17:48
08/15/07 17:48
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline
Senior Expert
HeelX  Offline
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
@yorisimo: this isn't supported by the compiler, but will be implemented in the future. In the meantime you could use a startup function to initialize it

Last edited by HeelX; 08/15/07 17:48.

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1