Snippet Buffer

Nestharus

o-o
Reaction score
84
JASS:

library Buffer
    //LoadToBuffer
    //  loads data from code into buffer (data not created)
    //
    //LoadFromBuffer
    //  loads data from buffer and creates it (data created)
    globals
        private integer s = 0
        private integer p = 0
        private integer array v
    endglobals
    struct Buffer extends array
        static method reset takes nothing returns nothing
            set s=0
            set p=0
        endmethod
        static method write takes integer val returns nothing
            set s=s+1
            set v<s>=val
        endmethod
        static method read takes nothing returns integer
            set p=p+1
            return v[p]
        endmethod
    endstruct
endlibrary
</s>
 

Dirac

22710180
Reaction score
147
This is so simple people could actually do this by themselves when coding. Why submitting this as a resource? You might need more than one of these so it's not really worth having it as a library
 

Nestharus

o-o
Reaction score
84
That was my thought as well : ), but sadly don't have time to update it and won't be able to get back to it for like 10 hours.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top