Hello, i mostly know how metatables work, although i don't know if when making a module, is this a good way to store __index function?
local module = {
__newindex = function(a1, a2, a3) -- The function is stored in table, that is returned
print(a1[1], a2)
end
}
function module.CreateSetup()
local statsToReplicate = {}
return setmetatable(statsToReplicate, module)
end
or should i create it like this, store the function in seperate table:
local module = {}
local metatable = {
__newindex = function(a1, a2, a3)
print(a1[1], a2)
end
}
...
return setmetatable(statsToReplicate, metatable)
Thanks, kirda

1 comment
okay thank you