• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] struct problem

Status
Not open for further replies.
im using bribes Table library im having a problem w the remove function thts used to remove values from the table

can anyone tell me how to do this correctly ?

here is the api for the function

JASS:
method remove takes integer key returns nothing
    |     remove the value at index "key"

here is what im trying
JASS:
set ht.remove( integer here)
 
Here is an example:
JASS:
struct Sample
    private static Table hash = 0

    real x 

    static method create takes nothing returns thistype
        local thistype this = thistype.allocate()

        set this.x = 5.2 // assign the variable to some value
 
        set hash.real[5] = this.x // store the value of this.x in the hash under index 5
        call BJDebugMsg(R2S(hash.real[5])) // should display "5.2"

        call hash.real.remove(5) // should remove the saved real
        return this
    endmethod

    private static method onInit takes nothing returns nothing
        set hash = Table.create() // initialize the table
    endmethod
endstruct

This is from memory though, so I can't guarantee whether it will compile. That is how it is used though, iirc.
 
Status
Not open for further replies.
Top