Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What are the advantages of weak tables and will I find myself using them in the future?

Asked by 5 years ago
Edited 5 years ago

From my understanding, you can set the values of a table to be weak with like this:

local x = {}
local m = {__mode = "v"}
setmetatable(x, m)

You can also set the keys to be weak with __mode = "k" and both the keys and values with __mode = "kv".

So my question is this:

What are weak tables useful for? Will I find myself using them in the future? Could I use them to help prevent possible garbage collection issues?

0
using multiple accounrts sounds like rep manip to me buddy, you're going to jail incappy LegitimatlyMe 519 — 5y
0
im not gonna answer my own question jermaIDE nerd i'm gonna see how much reps i can get from pure questions no answers programmerHere 371 — 5y
0
u should link this account so u never get past asker and lose access to tier2 and 3 :blush: LegitimatlyMe 519 — 5y
0
no programmerHere 371 — 5y
View all comments (2 more)
0
probably caching EpicMetatableMoment 1444 — 5y
0
make ur variables exist forever!! EpicMetatableMoment 1444 — 5y

Answer this question