Hi, I just encountered this issue with project data:
saveProjectData("test", "01000101001010000001010111100010101")
print(readProjectData("test"))
This outputs 1.0001009639802e+33, which means that number strings are saved as numbers instead of strings.
The only solution I have at the moment is to add a textual prefix, but that is really annoying. Shouldn’t strings be saved as strings?!
Ignatz
July 22, 2014, 11:12am
2
@jfperusse - I think everything is saved as strings, it is when it is loaded back that the problem occurs
@JakAttak , yes, I tried this.
@dave1707 , that’s exactly what I meant by “The only solution I have at the moment is to add a textual prefix” That’s the solution I am using now.
system
July 22, 2014, 9:47pm
4
Why don’t you try
saveProjectData("test", "01010010101000011010101000010")
strdat = tostring(readProjectData("test"))
print(strdat)
```
system
July 22, 2014, 9:48pm
5
Just a question… Is the string class immutable?
@aurumcoder2624 If you would have tried the code you suggested, you would have seen that it has the same problem as the original post.
system
July 22, 2014, 9:59pm
7
I know, but tostring makes the data a string, so the problem is blocked.
Fine, I agree with u. :-L
I had this problem while attempting to save passcodes in my unsuccessful ( ) passcode project. I have to make do with file IO, as global data, local data, and project data all seem to treat a string of numbers and numbers instead of strings.
The e+ stuff is scientific notation, it’s used to shorten long numbers.
@jfperusse One way around the problem is to put a letter as the first character of the string. You can then remove the letter after you read the data back.
Did you try saveProjectData(tostring(10101010101010101010101010101000001))
I haven’t tried it but if the problem is that it is being saved as a number this might help? otherwise you could do it how Sky does.
@jfperusse See this post that I made in Sept 2012.
http://codea.io/talk/discussion/1692/saveglobaldata#Item_16
@dave1707 , thanks! Interestingly, Simeon said he fixed it, and that was in 2012
@Simeon Can you look at this then look at the link I have above to a previous Sept 2012 discussion.