Im using Bribe's NewTable system and I've been having an issue with a Recipe system and I found the cause of it, but I cant figure out why its happening
This ends up printing
rec0:1
rec1:2
rec0:2
rec1:0
I dont know whats going on... If i run it again
rec0:2
rec1:0
rec0:3
rec1:0
and again
rec0:3
rec1:0
rec0:3
rec1:0
...
Any ideas?
JASS:
struct RecipeGroup
private Table recipes
private integer recIndex
public static method create takes nothing returns RecipeGroup
local thistype this = thistype.allocate()
set recipes = Table.create()
set recIndex = 0
return this
endmethod
public method add takes Recipe2 rec returns nothing
set recipes[recIndex] = rec
set recIndex = recIndex + 1
endmethod
public method check takes unit u, InventoryButton root returns nothing
local integer i = 0
local Recipe2 r
local TableArray t
loop
call print("rec0:"+I2S(recipes[0]))
call print("rec1:"+I2S(recipes[1]))
exitwhen recipes[i] == 0
//set r = recipes[i]
set t = TableArray[2]
// call r.check(u,root)
set i = i + 1
endloop
endmethod
endstruct
This ends up printing
rec0:1
rec1:2
rec0:2
rec1:0
I dont know whats going on... If i run it again
rec0:2
rec1:0
rec0:3
rec1:0
and again
rec0:3
rec1:0
rec0:3
rec1:0
...
Any ideas?