User Tools

Site Tools


maxrects-lua

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
maxrects-lua [2021/02/13 10:00]
muragami [:insert(width,height,data)]
maxrects-lua [2021/02/13 10:21] (current)
muragami [:insertCollection(collect,sort)]
Line 138: Line 138:
 Inserts a rectangle into the collection, using the algorithm to assign a location. If the rectangle can't fit, returns false. Copies .data into the stored node in the collection. Inserts a rectangle into the collection, using the algorithm to assign a location. If the rectangle can't fit, returns false. Copies .data into the stored node in the collection.
  
 +==== :insertCollection(collect,sort) ====
 +
 +  * **collect**: A table array of rectangles to insert into the collection (see [[#:insertRect(rect)]])
 +  * **//sort//**: //optional// A method to sort the rectangles before insert.
 +
 +  * **return**: Boolean, Number. True if all were inserted, False if only some fit. The number is the amount added.
 +
 +Inserts rectangles into the collection, from an array table. If you define sort to one of: 'SortArea', 'SortShortSide', or 'SortLongSide' it will sort them from biggest to smallest using that method before inserting. If you pass anything else as sort, it'll throw an error. Note: If you pass a sort, then **table.sort() is applied to collect, so it's order might/will be changed by this function.**
 ==== :occupancy() ==== ==== :occupancy() ====
  
maxrects-lua.1613239211.txt.gz ยท Last modified: 2021/02/13 10:00 by muragami