Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Export and readProjectTab(): New tabs not fully present until restarting Codea

edited January 16 in Bugs Posts: 10

New tabs are not able to be read by readProjectTab() until I restart Codea.
Those tabs also do not export to the clipboard until I restart Codea.
Code and functions on those tabs still work fine.

I create a new project and I add this function to the Main tab:

function testInAnOldTab()
    print("Don't call it a comeback.")
end

I put this function in a new tab named “New”

function testInANewTab ()
    print ("Yo Yo Yo.  Sup?")
end

I put this function in a new tab named AnotherNewFile:

itterateTabs = function()
    for i,v in pairs(listProjectTabs()) do
        local source = readProjectTab(v)
        for match in string.gmatch(source, "function%s-(test.-%(%))") do
            print( match )
            loadstring(match)()
        end
    end
end

parameter.action("Find Matches in Tabs", function()
    itterateTabs()
end)

The parameter.action in the new tab loads and the function is called when I press the button, but then it throws an error saying the tab does not exist. If I rearrange the tabs I get an error that traces back to a function on that same tab (that does not exist). (See image)

If I force quit Codea and try it again, it works as expected, no errors. (Second image)

Similar things happen if I work from the prompt >

—————

If I export to the clipboard from the project screen before I restart I get this:

--# Main
-- Blobject

-- Use this function to perform your initial setup
function setup()
    print("Hello World!")
end

function draw()
   background(40, 40, 50)
   strokeWidth(5)
end

function testInAnOldTab()
    print("Don't call it a comeback.")
end

--# NowOldFile

The last part is a remnant of a tab I deleted, but the new tabs do not export:

After restarting I get the full project when exporting:

--# Main
-- Blobject

-- Use this function to perform your initial setup
function setup()
    print("Hello World!")
end

function draw()
   background(40, 40, 50)
   strokeWidth(5)
end

function testInAnOldTab()
    print("Don't call it a comeback.")
end

--# AnotherNewFile
itterateTabs = function()
    for i,v in pairs(listProjectTabs()) do
        local source = readProjectTab(v)
        for match in string.gmatch(source, "function%s-(test.-%(%))") do
            print( match )
            loadstring(match)()
        end
    end
end

parameter.action("Find Matches in Tabs", function()
    itterateTabs()
end)

--# New
function testInANewTab ()
    print ("Yo Yo Yo.  Sup?")
end

Just FYI.
Thanks,
-Boone

Comments

Sign In or Register to comment.