So I want to make an object that can be created in multiple scripts, so I went with this approach:
Module Script Example:
local module = {}
Object = {}
function module:constructObject(x, y)
return setmetatable({x = x, y = y}, Object)
end
Object.__index = Object
function Object:getX()
return self.x
end
function Object:getY()
return self.y
end
return module
Now if I were to construct the object in another script written in the module above and call one of its methods, it would be considered to be nil. Is there a way around having to write object methods that are considered to be nil when called from a script that requires from the module?

1 comment
So it seems that the table the module returns is the object (?). Thanks!