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 Professional Discussion / Question about ARRAY commands.

Author
Message
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 16th Feb 2011 19:21
What's the difference between

ADD TO QUEUE Array()

and

ARRAY INSERT AT BOTTOM Array()

IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 16th Feb 2011 19:40
There's no difference. In fact, the ADD TO QUEUE calls the ARRAY INSERT AT BOTTOM to do its job.

KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 16th Feb 2011 20:40
I didn't really see a difference, just thought I'd ask to make sure.

Thanks.

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 16th Feb 2011 20:45
Quote: "There's no difference"


So whats the point of it?
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 16th Feb 2011 20:58
Simplification and standardisation.

When you want to use an array as a queue, there are commands there with 'queue' in the name. Same for stacks. All others deal with arrays as lists.

They each generally modify the array in the required way, but they also set the 'current' index of the array appropriately too.

See my codebase entries for examples (I don't think the code is too out of date).

KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 16th Feb 2011 21:25
One more question for ya.

Does UNDIM on an array free up the strings, or do you still need to do a x$(x) = Free String$() and then UNDIM x$()?

IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 16th Feb 2011 21:57
UNDIM frees strings - Lee added the code for straight string arrays, and I added to it last year so that it also worked for strings within UDT's too.

KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 16th Feb 2011 22:08
Nice. That makes things MUCH easier.

enderleit
19
Years of Service
User Offline
Joined: 30th May 2007
Location: Denmark
Posted: 16th Feb 2011 23:53
Hehe, I never knew about freeing strings when undimming... guess I don't have to anymore either then...

Login to post a reply

Server time is: 2026-07-16 03:10:15
Your offset time is: 2026-07-16 03:10:15