 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
xmOD
Joined: 29 Apr 2006 Posts: 10
|
Posted: Tue Jan 09, 2007 3:24 am Post subject: jumping to an offset.. |
|
|
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 |
|
 |
Roland35007
Joined: 07 Jan 2007 Posts: 7
|
Posted: Thu Jan 18, 2007 12:23 am Post subject: Offset |
|
|
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 |
|
 |
|
|
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
|