-
Posted by Alo on Wed, 14 Oct 2009 23:24:27
Continue loop?
I'm iterating through the loop of number of items from GetNumLootItems().
However, the problem is, I'd like it to do something to each slot item (using i as the variable slot number), but I can't seem to find a continue loop type of function.
So in other words, it'd be like
local numItems = GetNumLootItems() local bCoin = LootSlotIsCoin(i) for i = 1, numItems do if bCoin == true then LootSlot(i); continue; end if i === 2 then LootSlot(i); continue; end if i >= 3 then CloseLoot(); end print("Looted first two items") end
Obviously that's not good code, but I think it gets the gist of what I'm trying to convey. Once I've done something to that slot, I want to continue to the next item in the loop. How do I do that? Doesn't the break keyword kill the loop enirely?
-
Posted by jnwhiteh on Thu, 15 Oct 2009 21:37:20
Well it's very unclear what you're trying to do with that code. There is no continue in Lua, and in reality you very rarely need to use break either. You can just do all of this using conditionals (if/elseif/else), no?