forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

file i/o NOOB here

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
darklitch



Joined: 03 Oct 2005
Posts: 11

PostPosted: Sun Nov 06, 2005 2:44 am    Post subject: file i/o NOOB here Reply with quote

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
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
youresam



Joined: 06 Nov 2005
Posts: 87

PostPosted: Sun Nov 06, 2005 2:46 am    Post subject: Reply with quote

Look at the snake example.
Back to top
View user's profile Send private message AIM Address
darklitch



Joined: 03 Oct 2005
Posts: 11

PostPosted: Sun Nov 06, 2005 2:50 am    Post subject: Reply with quote

i don't think the snake example uses more than one line
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
youresam



Joined: 06 Nov 2005
Posts: 87

PostPosted: Sun Nov 06, 2005 3:13 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
LuMo



Joined: 21 Aug 2005
Posts: 410
Location: Austria

PostPosted: Sun Nov 06, 2005 8:25 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group