| View previous topic :: View next topic |
| Author |
Message |
darklitch
Joined: 03 Oct 2005 Posts: 11
|
Posted: Sun Nov 06, 2005 2:44 am Post subject: file i/o NOOB here |
|
|
How can i show new lines with file i/o? I am using the script:
highscoreFile = "1.txt"
function loadHighscore()
file = io.open(highscoreFile, "r")
if file then
high = file:read()
file:close()
end
end
when I edit the highscoreFile to:
asdf
adf
adfjkald
I get jkdsf then a musical note to appear. How can i get
asdf
adf
adfjkald
to appear?
Last edited by darklitch on Sun Nov 06, 2005 2:49 am; edited 1 time in total |
|
| Back to top |
|
 |
youresam
Joined: 06 Nov 2005 Posts: 87
|
Posted: Sun Nov 06, 2005 2:46 am Post subject: |
|
|
| Look at the snake example. |
|
| Back to top |
|
 |
darklitch
Joined: 03 Oct 2005 Posts: 11
|
Posted: Sun Nov 06, 2005 2:50 am Post subject: |
|
|
| i don't think the snake example uses more than one line |
|
| Back to top |
|
 |
youresam
Joined: 06 Nov 2005 Posts: 87
|
Posted: Sun Nov 06, 2005 3:13 am Post subject: |
|
|
It does. The options do.
I've created my own parody of Lua called LUAH. Of course, it runs in luaplayer, you edit a file called index.LUAH. It has the commands: clearscreen(color), display(text), refreshscreen(), wait(time in milliseconds), wait(start) [wait till start is pushed], while not start end, and /LUA/ followed by a LUA command. It works by analizing each line, then writes to a new Luaplayer file called 'luah.luah. It then runs it.
It should look something like: (well, not exaclty, I forgot the open commad)
file = ioopen("file", "*r")
for line in file:lines() do
end |
|
| Back to top |
|
 |
LuMo
Joined: 21 Aug 2005 Posts: 410 Location: Austria
|
Posted: Sun Nov 06, 2005 8:25 pm Post subject: |
|
|
new line is system dependend "\r" or "\n" some use combinations "\n\r" (or the other way around...)
greets _________________ "Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com |
|
| Back to top |
|
 |
|