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 / Queues, Lists, & Stacks?

Author
Message
Stan
23
Years of Service
User Offline
Joined: 24th Apr 2003
Location:
Posted: 24th Apr 2003 13:54
Firstly, hello. This is my first post here. My name is Stan. I've been a 3D hobbyist for several years. I first found DB about a year ago, and have dabbled with it, but not really tried to do much with it...yet. When DBPro was announced I purchase the upgrade. Now, I have some time and am trying my first code experiments.

I'm new to DBPro and trying to figure out queues, lists and stacks. I'm not sure I understand their implementation in DBPro.

If I understand, a list or a queue is nothing more than a standard array initialized to a null, no elements, state. Then, the various queue, list, and stack commands are used to create, insert, and remove new blank elements into the array. This is were I get lost. It looks as though the current element of a queue, list, or stack is read/retrieve from array index '0' [ as in ArrayName(0) ]. The code below shows a test for creating and reading a simple queue. When run, it looks as though the queue is being created, but I cannot later read from the queue.

Any help would be appreciated.
TIA, Stan
spooky
23
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 24th Apr 2003 14:23 Edited at: 24th Apr 2003 14:36
I agree. Can someone explain how to use as help on these functions are complete bo***cks!

I can just about use stacks, just don't specify the '0'

i.e.

dim x()

add to stack x()
x()=1
add to stack x()
x()=2
remove from stack x()
print x()
queues are the same I think.

Gronda, Gronda
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 24th Apr 2003 15:47
Yes, except that queues obviously remove from the front, and add to the back.

As long as you avoid inserting/delete at the top/middle of an array, all of the array handling routines work too.
Stan
23
Years of Service
User Offline
Joined: 24th Apr 2003
Location:
Posted: 25th Apr 2003 00:03
Thanks for the reply. I had to read your post twice before I understood. Reading the documentation or help files I concluded that one must reference array index '0' explicitly in Queue, List, or Stack operations.

Oh well, minor annoyance as long as things work. Removing the index seems to solve the problem for queues, at least.

Learning the particulars of a new language is a double-edged sword constructed of fascination and frustration. (Zaara)


;^)

Thanks,
Stan

Login to post a reply

Server time is: 2026-07-11 09:30:13
Your offset time is: 2026-07-11 09:30:13