I was just using metatables and instances to add custom properties and methods. I put the __index of the metatable to the instance that I'm trying to add extra properties to. But when I try to call a method such as customClass:FindFirstChild("SomeObjectName") I get this error:
Expected ':' not '.' calling member function FindFirstChild
(And yes, I called the function with a :)
My understanding is that there is something wrong with Indexing in lua so when it doesnt find the function insied the metatable it looks through the __index value and finds a function, and it calls it with the . instead of :.
I also tried doing customClass.FindFirstChild(customClass, "SomeObject") and the same error occured.
How would I fix this without adding all the indexes in the metatable then calling the functions in there?
Example of what I want to avoid having to do:
local _instance = Instance.new("Part")
local customClass = {}
customClass.__index = _instance
function customClass.FindFirstChild(name)
return _instance:FindFirstChild(name)
end
Any help is appreciated! If you need more information, just ask!
