View Single Post
06-20-12, 11:13 AM   #18
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,327
Originally Posted by Billtopia View Post
Code:
myTable = { {unpack( myTable )}, ... }
This not only creates 2 new tables, but also changes the table structure.

Due to the design specs of the library my function was taken from, creating new tables is not allowed and completely contradicts the purpose of the library in the first place. The library I had this code in is a table recycler for use in code that calls frequently, perhaps multiple times each rendering pass. The idea behind it is to mimic the table constructor accurately on an existing table. Using an existing table means there's no new tables building up in memory waiting for a garbage collection pass. An ability of this library is that deallocated tables are stored as weak values, meaning when the garbage collector does run, they are released to it if they haven't been reallocated.

Note mimicking the table constructor accurately means including this undocumented effect.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote