I've been using the undocumented LrUUID namespace for a while now without any problems, however I just had a user report the error:
Could not find namespace: LrUUID
He's using Lr3.4 on Vista
Anybody know in which version of Lightroom this namespace first appeared?
I can't imagine it being an OS thing(?)
Thanks,
Rob
The perils of using undocumented interfaces (of which I'm equally guilty :-<).
Seems unlikely that this would be dependent on the Windows version (i.e. not available in Vista). The result of LrUUID (on Windows 7) looks like a Windows GUID:
"C57FA964-8A58-4195-9A76-B6002A9633AC"
Windows GUIDs have been around since at least Windows NT 3.5, I think, when Microsoft collaborated on the DCE standard.
It does seem like an odd error to experience. Namespaces aren't typically
something that would change across OSes or even within a major release
cycle. Would have expected that namespace to have been available since at
least LR3.2 (but more likely LR3.0) so the upgrade shouldn't really be
necessary. Lets hope the upgrade fixes the problem for your user.
Thanks, Matt
(Apologies for the brevity - sent from my Android)
My solution:
| math.randomseed( LrDate.currentTime() ) -- moved from app constructor. | |
| local lrUuid = import 'LrUUID' | |
| if lrUuid ~= nil and lrUuid.generateUUID ~= nil and type( lrUuid.generateUUID ) == 'function' then | |
| -- good to go | |
| else | |
| -- Note: Lightroom uses HEX instead of Base-10, but that's a way to distinguish a "REAL" UUID from one of these PSEUDO UUIDs. | |
| lrUuid = { generateUUID = function() | |
| local n1, n2, n3, n4, n5, n6 | |
| n1 = math.random( 10000000, 99999999 ) -- 8-digit random num | |
| n2 = math.random( 1000, 9999 ) -- 4-digit random num | |
| n3 = math.random( 1000, 9999 ) -- 4-digit random num | |
| n4 = math.random( 1000, 9999 ) -- 4-digit random num | |
| n5 = math.random( 100000, 999999 ) -- 12-digit random num | |
| n6 = math.random( 000000, 999999 ) -- part 2. | |
| local pseudoUuid = string.format( "%8u-%4u-%4u-%4u-%6u%06u", n1, n2, n3, n4, n5, n6 ) | |
| return pseudoUuid | |
| end } | |
| end | |
| gbl:initVar( 'LrUUID', lrUuid, reloading ) -- not documented @LR3 |
North America
Europe, Middle East and Africa
Asia Pacific