Quantcast
WoWInterface - View Single Post - Storing placeholder value to SV
View Single Post
05-19-17, 06:46 AM   #4
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 431
You'll have to make the choice here yourself. Either waste resources by creating empty tables or waste resources by checking if the index is a table or boolean value on every checkup.

Assigning a table value for a specific key to nil will remove it from the table, rearrange the table structure, and send the old value off to garbage collection. Using true or false will keep the table key, however, if you're using false you have to explicitly check for it when doing a checkup.

It's a fairly common thing in Lua to use lookup tables, where you store the actual value as key and just omit the value. Usually you would use true as value in that case just to keep the table entry.
__________________
  Reply With Quote