(06-14-2012, 05:48 AM)Taugeshtu Wrote: Can I have cCraftingGrid:GetItems() to be exported in Lua?
It would be really waaaaay more easy to operate with cItem array rather than manually collect data with GetItem(x, y) for shapeless recipes.
I think that should be possible (because somehow PluginManager:GetAllPlugins() is possible), and even if not - could I have ForEachItem() similar to cRoot:ForEachWorld() then?
Sorry man, but I'm against using a ForEach() function for the crafting grid.
Just use this piece of code to iterate over all the items in the grid
Code:
for x=0, Grid:GetWidth()-1 do
for y=0, Grid:GetHeight()-1 do
local Item = Grid:GetItem(x, y)
end
end
I could export a function so Lua can easily iterate over the items in a linear fashion like this
Code:
for i, Item in ipairs( Grid:GetItems() ) do
-- Item contains the item
end
I just recommend the regular iterating over the grid.