Level Editor - Create, Edit and Read .lua files?

Hello,
I’m currently working on a level/visual editor.
As I’d like to add a little more flexibility to the editor I wanted to ask whether it is possible in some way to create/edit/read lua files that belong to a project. This would enable me to create classes with certain properties in the editor (e.g. add some variables, set position and color, add animations using UI instead of code, etc.) and program the game logic like normally in Codea.
Thanks

@Leon You can do everything you want. See the built in reference under Storage.

Oh, my bad. I only knew of readGlobalData and saveGlobalData. It’s been a while since I have actively used Codea and I’ve only recently updated from version 1.5.5, the last one my old iPad supported. Thank you @dave1707

@Leon Here’s an example for reading the tabs of the Examples project Ping.

function setup()
   coll="Examples:"
   proj="Ping"
   lst=listProjectTabs(coll..proj)
   for a,b in pairs(lst) do
       print(b.."  ==============")
       str=readProjectTab(coll..proj..":"..b)
       print(str)
   end
end

Thanks :slight_smile: @dave1707
It’s actually quite easy to use. Sometimes the text in the tabs doesn’t update immediately and the project has to be closed, but apart from that it seems to work. I got another question, however. Is there some way to format the text?
So that if I use: saveProjectTab(“Tab”, “function test() end”)
“function test()” and “end” are not in the same line.

@Leon You need to add “
” between test() and end to force end on the next line.

function setup()
    saveProjectTab("Tab","function test()\
end")
end

Thanks! @dave1707
I don’t really know why, but sometimes when reading a tab I get an error saying that the tab couldn’t be found. I have already tried this multiple times but the tabs that are supposed to be read do exist.

@Leon @Simeon When you have trouble reading a tab, can you exit Codea, come back in and read it OK. Can you eventually read it or not at all. Are you trying to read a tab in the current project or in a different project.

@Leon @Simeon I’m getting the same problem when I try it. I have to completely get out of Codea before it works. Simeon, I know your doing something with updating the code, but it’s not working very good so far. Maybe there can be a button in the editor to force an update or maybe force an update when the code is run or closed.

@dave1707 @Leon I see what you mean. When I put that code in setup it sometimes creates the tab, other times I have to close and re-open the project to see the change.

I’m going to look into what’s happening here and fix it for the update after next (Apple’s still reviewing 2.6.3).

Sorry, I forgot to reply. Thanks @Simeon