I am new to Codea and just trying to get a few simple things going and having difficulties. I put together a small app that records the time when you tap the screen and then plots the data afterwards, very vanilla compared to some of the things I've seen on this forum. Here are some observations/questions:
Now I'm trying to display the data that was created.
Request for new feature:
One final question for future reference:
How does one copy code into the forum, preferably without lots of escaping?
Bob
@starblue I'm going to try to address some of your questions now and come back to some others later when I've looked into them.
• Touch events don't have timestamps. At the moment you can use ElapsedTime to count the time between touches, but it might be a good feature to add.
• writeProjectData can only save numbers and strings for now. We want to fix this, but you're correct that the documentation is wrong at the moment.
• I'm not too familiar with string.gmatch. Perhaps try your gmatch code on http://repl.it (choose Lua) and see if the behaviour is as you expect.
• The graph only needing to be rendered once: you can do this by setting backingMode(RETAINED). This will force the iPad to re-draw the previous frame buffer every frame. So your drawing operations will persist (don't call background() in draw, though).
New features
Very good, practical, suggestions. I'm working on the first because it drives me crazy as well. Find and replace will come too.
Real serialisation is a bit trickier, given the sorts of things that can be stored in tables - classes and userdata in particular. But it's in our thoughts for the future.
As @jlslate mentioned, fencing your code with ~~~ (3xTilde) will render it correctly.
@starblue: maybe try this for your time extraction
string = "my time is 2:30, 3:45, and some more 5:35"
string = string .. "and again a few more 3:23, 6:26, ..., finally 8:45"
extract={}
for w in string.gmatch(string,"%d+:%d+") do
extract[#extract+1]=w
end
for i=1, #extract do
print("number "..i.." has value "..extract[i])
end
It looks like you're new here. If you want to get involved, click one of these buttons!