Hi,
I'm learning to write files via celestia with the "io.open()"
using the function that is on page
viewtopic.php?f=9&t=8326 but nothing happens.
He says that Celestia wrote the file but there isn't anything in the file.
I can not understand what is wrong...
Someone can help me?
Thanks in advance!
How to write inside files
Re: How to write inside files
It works fine for me under Windows XP SP3 using Celestia v1.5.1.
Here's the minimal example code, leaving out the on-screen display and writing to Celestia's extras directory
First it asks if you want to allow I/O operations.
Then the file text.txt is created in Celestia's extras folder on my computer. It contains the string
Hello, Universe!
Here's the minimal example code, leaving out the on-screen display and writing to Celestia's extras directory
Code: Select all
celestia:requestsystemaccess()
myfile = io.open("extras/test.txt","w")
text = "Hello, Universe!"
myfile:write(text)
myfile:close()
First it asks if you want to allow I/O operations.
Then the file text.txt is created in Celestia's extras folder on my computer. It contains the string
Hello, Universe!
Selden
Re: How to write inside files
selden wrote:It works fine for me under Windows XP SP3 using Celestia v1.5.1.
Here's the minimal example code, leaving out the on-screen display and writing to Celestia's extras directoryCode: Select all
celestia:requestsystemaccess()
myfile = io.open("extras/test.txt","w")
text = "Hello, Universe!"
myfile:write(text)
myfile:close()
First it asks if you want to allow I/O operations.
Then the file text.txt is created in Celestia's extras folder on my computer. It contains the string
Hello, Universe!
Your code works. I don't know why the other not!
I'm starting to yours!
thank you very much!