Meta tables and cloning

So Metatables are supposed to save memory so
if I were to use table.clone() on a Metatable, would that clone the Metatables functions
or would it be the same as just doing

local newMeta = setmetatable({}, oldMeta)

My purpose for this is to clone the contents of the Metatable like variables

You can’t clone a metatable i think because of the special functionality it provides. It’s the same as trying to pass a metatable through an event, it will be a plain table

Well I tested it with table.clone and it kept the functions BUT I’m not sure if its cloning the functions using more memory

Don’t quote me but I think since copy returns a different table than the one its getting cloned from then it will create new memory addresses for the functions too. You could try printing the memory addresses of the functions and see

Oh yeah it seems the memory address when I print both are the same
so I’m guessing its doing as I wanted it to and not creating a whole new function

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.