I have a class defined like so:
local MyClass = {
_VERSION = 'MyClass 1.0.0'
}
MyClass.__index = MyClass
setmetatable(MyClass, {
__call = function (cls, ...)
return cls.new(...)
end
})
function MyClass.new(prop1)
local self = setmetatable({}, MyClass)
self.prop1 = prop1
return self
end
function MyClass:msg(txt)
self.prop1 = txt
print(self.prop1)
end
function MyClass:callFunc(func, ...)
pcall(func, ...)
end
My client code may look like:
local inst = MyClass("value 1")
inst:msg("Hello world")
inst:callFunc(inst:msg, "Hello again")
When I run this client code, I get an error message
function arguments expected near ','
The code is completely reprodicible. You can easily check it here. Just copy paste and run it and you will get this error message. How can I fix it?