New game dev series involving Codea

? Really?

What I want to be able to do is export files in text, and be able to add them as assets in a completely different project.

So for example, export a CSV file, or something similar, then be able to add that file to a different project the way I add any other asset. I can do this now?

The saveGlobalData will save a string object (it is easy to convert to and from CSV) which can be read from any other project.

@Serapth Here you go

function writeFile(fileName, data)
    local file = os.getenv("HOME") .. "/Documents/Dropbox.assetpack/" .. fileName
    wFd, err = io.open(file, "w")
    if wFd == nil then
        error("\
\
Error creating/editing file " .. fileName .. "\
\
Error: " .. err)
    end
    wFd:write(data)
    wFd:close()
    print("File " .. fileName .. " installed!")
end
function readFile(fileName)
    local file = os.getenv("HOME") .. "/Documents/Dropbox.assetpack/" .. fileName
    rFd, err = io.open(file, "r")
    if rFd == nil then
        error("\
\
Error reading file " .. fileName .. "\
\
Error: " .. err)
    end
    local ret = rFd:read("*all")
    rFd:close()
    return ret
end

It puts the files in your Dropbox, so you can even open them on another computer.

@Ignatz This method puts them in separate files, so nothing conflicts and you can view them in iExplorer.

Very useful

Ahh, I knew about global data, but it would still be tied to the local codea install, so it was a no go.

However, I didn’t realize you could simply do text file io to and from Dropbox. Thanks, that’s exactly what I needed.