Skip to main content
Known Participant
Aug 12, 2010 6:50 AM UTC
Answered

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

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)

This topic is closed to new replies. Start a new post to keep the conversation going.
areohbee
areohbeeCorrect answer
Legend
Aug 12, 2010 8:56 AM UTC

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

3 replies

areohbee
areohbeeCorrect answer
Legend
Aug 12, 2010 8:56 AM UTC

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
Known Participant
Aug 12, 2010 4:51 PM UTC

Thanks Rob! That cleared the error.

Translate
areohbee
Legend
Aug 12, 2010 9:09 PM UTC

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