Lua check if method exists
use instance.myMethod
or instance["myMethod"]
The colon syntax is only allowed in function calls and function definitions.
instance:myMethod()
is short for instance.myMethod(instance)
function Class:myMethod() end
is short for function Class.myMethod(self) end
function Class.myMethod(self) end
is short for Class["myMethod"] = function (self) end
Maybe now it becomes obvious that a method is nothing but a function value stored in a table field using the method's name as table key.
So like with any other table element you simply index the table using the key to get the value.