3 Replies Latest reply on Jan 15, 2012 3:17 AM by DawMatt

    New version of Debugging Toolkit

    johnrellis Most Valuable Participant

      I've released version 1.3 of the Debugging Toolkit , which makes Debug.pp compatible with LR 4 beta. Please let me know of any issues. If anyone other than Rob uses this, drop me a note so I have some sense of usage.

       

      It uses the following function to determine whether a value is an SDK object (e.g. LrFolder):

       

      --[[----------------------------------------------------------------------------
      private boolean
      isSDKObject (x)

       

      Returns true if "x" is an object implemented by the LR SDK. In LR 3, those
      objects are tables with a string for a metatable, but in LR 4 beta,
      getmetatable() raises an error for such objects. 
      ------------------------------------------------------------------------------]]

       

      local majorVersion = LrApplication.versionTable ().major

       

      local function isSDKObject (x)
          if type (x) ~= "table" then
              return false
          elseif majorVersion < 4 then
              return type (getmetatable (x)) == "string"
          else
              local success, value = pcall (getmetatable, x)
              return not success or type (value) == "string"
              end
          end