Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

?:0: attempt to call upvalue '?' (a nil value)

Engaged ,
Aug 11, 2010 Aug 11, 2010

I can't seem to get rid of this error (' ?:0: attempt to call upvalue '?' (a nil value) ').  What is "?:0:" ?

Thanks in advance for any help!

script:

local LrApplication = import 'LrApplication'
local LrDialogs = import 'LrDialogs'
local LrFileUtils = import 'LrFileUtils'
local catalog = LrApplication.activeCatalog()
local LrTasks = import 'LrTasks'


    function searchNtag()
        local targPhotos = catalog.getAllPhotos()
        for _, photo in ipairs(targPhotos) do
            local status = photo:getPropertyForPlugin('com.jonathonlefaive.tagstatus', 'tagboolean')
            if status then
                if status == nil then
                    local location = photo:getRawMetadata('path')
                    if LrFileUtils.isDeletable(location) == true then
                        photo:setPropertyForPlugin('com.jonathonlefaive.tagstatus', 'tagboolean', false, 2)
                    else
                        photo:setPropertyForPlugin('com.jonathonlefaive.tagstatus', 'tagboolean', true, 2)
                    end
                end
            end
        end
    end

function task()
    catalog.withPrivateWriteAccessDo(searchNtag)
end

LrTasks.startAsyncTask(task)

TOPICS
SDK
2.9K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Aug 12, 2010 Aug 12, 2010

catalog.func should be catalog:func (colon instead of dot)

i.e. all catalog functions are object methods not static functions.

PS - not sure the meaning of the cryptic error message but I think this is your problem.

Rob

Translate
LEGEND ,
Aug 12, 2010 Aug 12, 2010

catalog.func should be catalog:func (colon instead of dot)

i.e. all catalog functions are object methods not static functions.

PS - not sure the meaning of the cryptic error message but I think this is your problem.

Rob

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 12, 2010 Aug 12, 2010

Thanks Rob! That cleared the error.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 12, 2010 Aug 12, 2010
LATEST

You're welcome Jonathon,

And, here's my wild guess as to the meaning of the error message:

When you use a dot, the function is still being called, its just that the first argument is nil (the expected 'self' argument), and

- There are no symbols for it - thus the question mark instead of a name.

- The value is zero - thus the zero (nil == 0).

Summary: Not sure what an "upvalue" is, but it makes sense to me in this context that its referring to the missing 'self' argument.

Just a guess.

_R_

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines