Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Ayumi), 1,395 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 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 | chip programmers | 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