View Single Post
05-19-17, 11:44 PM   #5
Layback_
An Onyxian Warder
Join Date: Feb 2016
Posts: 358
Originally Posted by MunkDev View Post
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.
Hi MunkDev,

At this stage, I decided to continue using empty tables as I guess this is the easiest way to maintain my codes.

Thank you for your advice!!
  Reply With Quote