<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:clearspace="http://www.jivesoftware.com/xmlns/jive/rss" version="2.0">
  <channel>
    <title>Adobe Community: Message List - Problem with getmetatable() of SDK objects in LR 4 beta</title>
    <link>https://forums.adobe.com/community/lightroom/lightroom_sdk?view=discussions</link>
    <description>Most recent forum messages</description>
    <language>en</language>
    <pubDate>Thu, 26 Apr 2012 23:06:38 GMT</pubDate>
    <generator>Jive Engage 7.0.0.1  (http://jivesoftware.com/products/)</generator>
    <dc:date>2012-04-26T23:06:38Z</dc:date>
    <dc:language>en</dc:language>
    <item>
      <title>Re: Problem with getmetatable() of SDK objects in LR 4 beta</title>
      <link>https://forums.adobe.com/message/4364101?tstart=0#4364101</link>
      <description>&lt;!-- [DocumentBodyStart:2ab08b5d-7e25-4ad5-9950-0a063c8434a8] --&gt;&lt;div class="jive-rendered-content"&gt;&lt;p&gt;Hmm, I just tested LR 4.0 on Mac OS 10.7.3, and getmetatable() applied to an SDK object produces an error message, the same as on Windows:&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;a href="https://forums.adobe.com/servlet/JiveServlet/showImage/2-4364101-187779/Capture.PNG"&gt;&lt;img alt="Capture.PNG" class="jive-image jive-image-thumbnail" height="213" onclick="" src="https://forums.adobe.com/servlet/JiveServlet/downloadImage/2-4364101-187779/450-213/Capture.PNG" width="450"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Are you sure about what you're observing?&lt;/p&gt;&lt;/div&gt;&lt;!-- [DocumentBodyEnd:2ab08b5d-7e25-4ad5-9950-0a063c8434a8] --&gt;&lt;img src='/beacon?t=1415888235911' /&gt;</description>
      <pubDate>Thu, 26 Apr 2012 23:06:38 GMT</pubDate>
      <author>forums_noreply@adobe.com</author>
      <guid>https://forums.adobe.com/message/4364101?tstart=0#4364101</guid>
      <dc:date>2012-04-26T23:06:38Z</dc:date>
      <clearspace:dateToText>2 years 7 months ago</clearspace:dateToText>
      <clearspace:objectType>0</clearspace:objectType>
    </item>
    <item>
      <title>Re: Problem with getmetatable() of SDK objects in LR 4 beta</title>
      <link>https://forums.adobe.com/message/4362728?tstart=0#4362728</link>
      <description>&lt;!-- [DocumentBodyStart:7da1eede-f7d0-446c-ae59-fdee0102ca43] --&gt;&lt;div class="jive-rendered-content"&gt;&lt;p&gt;Interestingly, this doesn't seem to be a problem with LR4 on OS X.&amp;nbsp; I have a plug that works perfectly well in LR 3.x on both Windows and OS X and in LR 4 on OS X, but which throws this error in LR 4 on Windows.&lt;/p&gt;&lt;/div&gt;&lt;!-- [DocumentBodyEnd:7da1eede-f7d0-446c-ae59-fdee0102ca43] --&gt;</description>
      <pubDate>Thu, 26 Apr 2012 13:54:31 GMT</pubDate>
      <author>forums_noreply@adobe.com</author>
      <guid>https://forums.adobe.com/message/4362728?tstart=0#4362728</guid>
      <dc:date>2012-04-26T13:54:31Z</dc:date>
      <clearspace:dateToText>2 years 7 months ago</clearspace:dateToText>
      <clearspace:replyCount>1</clearspace:replyCount>
      <clearspace:objectType>0</clearspace:objectType>
    </item>
    <item>
      <title>Re: Problem with getmetatable() of SDK objects in LR 4 beta</title>
      <link>https://forums.adobe.com/message/4134688?tstart=0#4134688</link>
      <description>&lt;!-- [DocumentBodyStart:080ddbd2-893c-479c-8bf0-c44425f1656d] --&gt;&lt;div class="jive-rendered-content"&gt;&lt;p&gt;I don't think testing for a :type() method and then invoking it solves the problem reliably. Suppose Debug.pp() has a code fragment like this: &lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="padding-left: 30px;"&gt;if type (x.type) == "function" then&lt;/p&gt;&lt;p style="padding-left: 60px;"&gt;local sdkType = x:type () &lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Without any way of knowing that "x" is in fact an SDK object, the method call x:type() could result in an error.&amp;nbsp; For example, "x" could be an object defined by the plugin, with a method :type() that requires arguments.&amp;nbsp; In that case, calling x:type() with no arguments would raise an error. To avoid that possibility, we could wrap the call to :type() with pcall, or we need some other reliable way of determining if an object is an SDK object.&amp;nbsp; &lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Debug.pp() could require that any objects passed to it don't have a :type() method or, if they do, that it conforms to the SDK semantics, but that makes Debug.pp() less general and more fragile.&amp;nbsp; The debugging environment for the SDK is already very weak and tenuous, so as a principle, it's good to avoid further weakening whenever possible.&amp;nbsp; (It's too bad that Adobe felt compelled to disable most of the Lua debugging primitives.)&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Note that once we know that a value "x" is an SDK object, tostring(x) will return it's type (e.g. "LrFolder"), whether it's an old-style SDK object or a new-style SDK object.&lt;/p&gt;&lt;/div&gt;&lt;!-- [DocumentBodyEnd:080ddbd2-893c-479c-8bf0-c44425f1656d] --&gt;</description>
      <pubDate>Thu, 12 Jan 2012 06:49:20 GMT</pubDate>
      <author>forums_noreply@adobe.com</author>
      <guid>https://forums.adobe.com/message/4134688?tstart=0#4134688</guid>
      <dc:date>2012-01-12T06:49:20Z</dc:date>
      <clearspace:dateToText>2 years 10 months ago</clearspace:dateToText>
      <clearspace:replyCount>2</clearspace:replyCount>
      <clearspace:objectType>0</clearspace:objectType>
    </item>
    <item>
      <title>Re: Problem with getmetatable() of SDK objects in LR 4 beta</title>
      <link>https://forums.adobe.com/message/4134494?tstart=0#4134494</link>
      <description>&lt;!-- [DocumentBodyStart:4e6919b6-2f49-4162-a9c2-354b9df8b940] --&gt;&lt;div class="jive-rendered-content"&gt;&lt;p&gt;Hi John,&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I think you used the right approach to raise this issue.&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;My personal view is the "correct" solution to this issue is to provide a&lt;/p&gt;&lt;p&gt;type() method for every SDK class, so you can call that instead. Will see&lt;/p&gt;&lt;p&gt;what happens.&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Your workaround looks OK, though you might want to add a test for and call&lt;/p&gt;&lt;p&gt;to the type() method where it is available. This would cut down on the&lt;/p&gt;&lt;p&gt;number of unknown object types you have to report.&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Thanks,&lt;/p&gt;&lt;p&gt;Matt&lt;/p&gt;&lt;/div&gt;&lt;!-- [DocumentBodyEnd:4e6919b6-2f49-4162-a9c2-354b9df8b940] --&gt;</description>
      <pubDate>Thu, 12 Jan 2012 03:03:56 GMT</pubDate>
      <author>forums_noreply@adobe.com</author>
      <guid>https://forums.adobe.com/message/4134494?tstart=0#4134494</guid>
      <dc:date>2012-01-12T03:03:56Z</dc:date>
      <clearspace:dateToText>2 years 10 months ago</clearspace:dateToText>
      <clearspace:replyCount>3</clearspace:replyCount>
      <clearspace:objectType>0</clearspace:objectType>
    </item>
    <item>
      <title>Re: Problem with getmetatable() of SDK objects in LR 4 beta</title>
      <link>https://forums.adobe.com/message/4133795?tstart=0#4133795</link>
      <description>&lt;!-- [DocumentBodyStart:c2a73df2-44df-4d18-bd01-122e6c754a5a] --&gt;&lt;div class="jive-rendered-content"&gt;&lt;p&gt;I use it &lt;span aria-label="Happy" class="emoticon-inline emoticon_happy" style="height:16px;width:16px;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;PS - I have no clue more than you, so charge ahead I guess...&lt;/p&gt;&lt;/div&gt;&lt;!-- [DocumentBodyEnd:c2a73df2-44df-4d18-bd01-122e6c754a5a] --&gt;</description>
      <pubDate>Wed, 11 Jan 2012 21:33:55 GMT</pubDate>
      <author>forums_noreply@adobe.com</author>
      <guid>https://forums.adobe.com/message/4133795?tstart=0#4133795</guid>
      <dc:date>2012-01-11T21:33:55Z</dc:date>
      <clearspace:dateToText>2 years 10 months ago</clearspace:dateToText>
      <clearspace:objectType>0</clearspace:objectType>
    </item>
    <item>
      <title>Problem with getmetatable() of SDK objects in LR 4 beta</title>
      <link>https://forums.adobe.com/message/4133714?tstart=0#4133714</link>
      <description>&lt;!-- [DocumentBodyStart:999b1f81-1faa-4a2c-9279-e03e65a66713] --&gt;&lt;div class="jive-rendered-content"&gt;&lt;p&gt;See this post in the LR 4 beta forum for an interesting issue that affects Debug.pp:&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;a class="jive-link-thread-small" data-containerId="4704" data-containerType="14" data-objectId="947975" data-objectType="1" href="https://forums.adobe.com/thread/947975"&gt;http://forums.adobe.com/thread/947975&lt;/a&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Not sure where the best place to post it is, given the volume of messaging in that forum and that no employees seem to read this forum.&amp;nbsp; If I don't hear anything in a while, I'll incorporate my hypothesized workaround into Debug and publish a new version for the few people besides me who might be using it.&lt;/p&gt;&lt;/div&gt;&lt;!-- [DocumentBodyEnd:999b1f81-1faa-4a2c-9279-e03e65a66713] --&gt;</description>
      <pubDate>Wed, 11 Jan 2012 20:58:12 GMT</pubDate>
      <author>forums_noreply@adobe.com</author>
      <guid>https://forums.adobe.com/message/4133714?tstart=0#4133714</guid>
      <dc:date>2012-01-11T20:58:12Z</dc:date>
      <clearspace:dateToText>2 years 10 months ago</clearspace:dateToText>
      <clearspace:replyCount>5</clearspace:replyCount>
      <clearspace:objectType>0</clearspace:objectType>
    </item>
  </channel>
</rss>

