Better way to create a "soft depend"?
#3
Much easier way is to use the reverse dependency (and the API was designed for that usecase):
-- Library plugin
function MyLibFunction(a_Param)
  return true
end

-- Client plugin
if not(cPluginManager:Get():CallPlugin("LibPlugin", "MyLibFunction", 47) then
  -- Library not available
else
  -- Library code executed
end
This still does spam the error in the console if the library plugin is missing, but it is the intended way of doing things and the console message will be removed sometime in the future. The only limit that this has is that the library function doesn't return nil as a regular value - nil is used for detection whether the call succeeded.
Reply
Thanks given by:


Messages In This Thread
RE: Better way to create a "soft depend"? - by xoft - 12-08-2015, 02:25 AM



Users browsing this thread: 1 Guest(s)