I am making an OOP module, should I use metatables?
Example of what I mean:
-- metatables
local module = { }
module.__index = module
function module.new()
local Class = setmetatable({ }, module)
Class.Instance = "something"
return Class
end
or should I do:
local module = { }
function module.new()
local t = { }
function t:print(...)
print(...)
end
return t
end
return module
I believe they achieve the same thing. If not, tell me!