Code:
--save this in your namespace:
self.libSafe = LibStub("LibSafe").new(self, self.name, self.saveVariablesName, self.debug)
--make your addonTable safe with error logging:
self.libSafe:makeTableSafe()
--make another table safe:
LibStub("LibSafe"):makeTableSafe(workTable)
--make another table safe with error logging:
LibStub("LibSafe"):makeTableSafe(workTable, self.libSafe)
Code:
--call a function of the table that was passed as first parameter to LibSafe.new(self,...):
local try, ret0, ret1 = self.libSafe:call(self.workFunction, arg0, arg1)
--call a function of any other table:
local try, ret0, ret1 = self.libSafe:callTable(workTable, workTable.workFunction, arg0, arg1)
--or static (no eror logging):
local try, ret0, ret1 = LibStub("LibSafe"):callTable(workTable, workTable.workFunction, arg0, arg1)
--call a tableless function:
local try, ret0, ret1 = self.libSafe:callFn(workFunction, arg0, arg1)
--or static (no eror logging):
local try, ret0, ret1 = LibStub("LibSafe"):callFn(workFunction, arg0, arg1)