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 

jumping to an offset..

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



Joined: 29 Apr 2006
Posts: 10

PostPosted: Tue Jan 09, 2007 3:24 am    Post subject: jumping to an offset.. Reply with quote

Hey,

i am new to LUA and dont know much indepth about it..

My question is.. Say for example i have a file containing many lines of text/code... Now what i want to do is when i press the button 'x' then the screen should show the text which is on the offset 0x0002DE0 , how can i do this?

this is the kind of code i am using at the moment..

Code:
somecolor = Color.new(0, 150, 150)

while true do
screen:clear()

y = 10
file = io.open("Filename.txt","r")
for line in file:lines() do
y = y + 10
screen:print(100,y,line,somecolor)
end

pad = Controls.read()
if pad:cross() then
<insert the jump code here>
end

if pad:triangle() then
Break
end

screen.waitVblankStart()
screen.flip()
end
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Roland35007



Joined: 07 Jan 2007
Posts: 7

PostPosted: Thu Jan 18, 2007 12:23 am    Post subject: Offset Reply with quote

What you are trying to do sounds like walking through a file in Binary Random mode. Perhaps when you open a file, you should use the binary switch (b)
like

file = io.open("Filename.txt","rb")

According to the lua 5 manual you should be able to jump to your offset with the instruction file:seek

Good luck!
Back to top
View user's profile Send private message
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