Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Multi Dimensional Arrays, Mixing data Types

Author
Message
Post Mortem Productions
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: - Please Select -
Posted: 12th Jul 2003 19:14
Is there a way I can mix data types within multidimensional arrays, as in like having something like this, only without the error message??
Hamish McHaggis
22
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 12th Jul 2003 19:22
The only ways I can think of is to have 2 1 dimensional arrays, but you want 1 multidimensional array so thats no use. Another way is to store the numbers as a string and have a string array. IE. have quotes around the numbers, e.g.

gang_stats$(1,1)="16"
gang_stats$(1,2)="100"
gang_stats$(1,3)="50 Cent"

Then to read the numbers back you can go...

value = val(gang_stats$(1,1))

I'm not sure how much you know, but val() converts strings to numerical values, but it only works if you have just numerical charcters in your string, if you have any letters the value returned will be 0 (I think). str$() does the same, except it converts numerical values to strings, e.g.

value$ = str$(100)

That will store "100" in your string variable.

cuRant PRogekt: a three-de map editer
Why the hell'd you ask me for crying out loud!?!
Athelon XP 1400 Plus - Nvidia Geforce MX400 - 256mb RAM

Login to post a reply

Server time is: 2025-05-19 11:15:49
Your offset time is: 2025-05-19 11:15:49