Storing placeholder value to SV
View Single Post
05-19-17, 06:46 AM
A Scalebane Royal Guard
Join Date: Mar 2015
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
as value in that case just to keep the table entry.
View Public Profile
Send a private message to MunkDev
Visit MunkDev's homepage!
Find More Posts by MunkDev