Linked Lists?

_whelp

New Member
Reaction score
54
Are linked lists like arrays?
And how do you use them in JASS?

Sorry if this is the wrong section or something...
 

Azlier

Old World Ghost
Reaction score
461
A linked list is basically a bunch of objects that point to eachother.

JASS:
struct Node
   Node next
   Node prev
endstruct


Say that this is a very basic list node, for a doubly linked list.

A linked list can only move through objects in one direction, a doubly linked list can move in both directions.

JASS:
globals
    Node List
endglobals

private function Init takes nothing returns nothing
    set List = Node.create()
    set List.next = Node.create()
    set List.next.next = Node.create()


Need a better explanation? I'm sure you do, because I'm bad at explaining things.
 

_whelp

New Member
Reaction score
54
Thanks again, lol... but wouldn't it be a hassle to keep putting List.prev or List.next with more .next's or .prev's?
 

Azlier

Old World Ghost
Reaction score
461
Yes, but that never actually happens in practice.
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
linkedlist.jpg


lol.
 

Romek

Super Moderator
Reaction score
963
I'm currently writing an in-depth tutorial on Linked Lists in vJass.

If no answers in this thread suit your needs, worry not, as the tutorial will be posted sometime soon. :)
 

Compute(<>)

New Member
Reaction score
1
thank you Romek i dont really underdtand all the link list stuff and that the tutorial will be most usefull.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top