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 

Problem with Print()

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



Joined: 24 Dec 2005
Posts: 200

PostPosted: Tue Jun 06, 2006 5:43 am    Post subject: Problem with Print() Reply with quote

print("string") does not work anymore?! any reasons why?

Im using v0.20 I noticed it does not work in 0.18+
Back to top
View user's profile Send private message
KawaGeo



Joined: 27 Aug 2005
Posts: 191
Location: Calif Mountains

PostPosted: Wed Jun 07, 2006 12:01 am    Post subject: Reply with quote

I don't know where print() should print but have you tried io.write("string\n")?
_________________
Geo Massar
Retired Engineer
Back to top
View user's profile Send private message Send e-mail
romero126



Joined: 24 Dec 2005
Posts: 200

PostPosted: Wed Jun 07, 2006 6:41 am    Post subject: Reply with quote

neither work
Back to top
View user's profile Send private message
Altair



Joined: 20 May 2006
Posts: 76
Location: The Netherlands

PostPosted: Wed Jun 07, 2006 10:43 am    Post subject: Reply with quote

and you are using "screen:print()", right?
Back to top
View user's profile Send private message
romero126



Joined: 24 Dec 2005
Posts: 200

PostPosted: Thu Jun 08, 2006 5:20 am    Post subject: Reply with quote

no just the command print() which used to work for debugging purposes.
Back to top
View user's profile Send private message
KawaGeo



Joined: 27 Aug 2005
Posts: 191
Location: Calif Mountains

PostPosted: Thu Jun 08, 2006 6:19 am    Post subject: Reply with quote

Perhaps print() command writes somehting on the back buffer of the screen. If so, flip the screen to read the output. If no help, the screen should be turned off somehow in order to view the output on PSP. Of course, you can use Windows version to debug but the version is pretty old.
_________________
Geo Massar
Retired Engineer
Back to top
View user's profile Send private message Send e-mail
romero126



Joined: 24 Dec 2005
Posts: 200

PostPosted: Thu Jun 08, 2006 6:38 am    Post subject: Reply with quote

I cant use an old version to debug im useing 5.1 syntax for some file manipulation. And if memory serves me file manipulation has a big problem in the windows client.

Also screen.flip() does not allow me to show an output either. I did a work arround but its a nasty hack I would rather not use.
Back to top
View user's profile Send private message
KawaGeo



Joined: 27 Aug 2005
Posts: 191
Location: Calif Mountains

PostPosted: Thu Jun 08, 2006 7:39 am    Post subject: Reply with quote

Sorry, dude. I tried to help.

Perhaps, you could implement Windows version for Lua 5.1 with some additional features as needed in order to debug your thingy. You could get the source at lua.org. I know it is a nasty job to do.

I do mine for Windows version but it is not for PSP. It is all written in Pascal rather than ANSI C.

PS If you do the Windows version, share it with other PSP coders. You'll get a metal with a flying color. :)
_________________
Geo Massar
Retired Engineer
Back to top
View user's profile Send private message Send e-mail
youresam



Joined: 06 Nov 2005
Posts: 87

PostPosted: Thu Jun 08, 2006 7:41 am    Post subject: Reply with quote

print() hasnt worked since the release of .18alpha
Back to top
View user's profile Send private message AIM Address
daurnimator



Joined: 11 Dec 2005
Posts: 38
Location: melbourne, australia

PostPosted: Thu Jun 08, 2006 10:21 am    Post subject: Reply with quote

and i think it shouldn't....

get a serial cable to debug... - or just print to the screen...
Back to top
View user's profile Send private message MSN Messenger
romero126



Joined: 24 Dec 2005
Posts: 200

PostPosted: Thu Jun 08, 2006 3:59 pm    Post subject: Reply with quote

Quote:
get a serial cable to debug... - or just print to the screen...

print() is the function i am talking about for such matters. Instead of,

screen:print(0, 0, "text", color.new(0,0,0))
screen.waitVblankStart()
screen.flip()

For each variable output is perposterous just for the sake of a 30 second debug. Print("variable :".. var)

now immagine doing that for multiple variables. Thats just a waste of debugging time a person just wasted on getting data.

Print needs to work, I was posting that it doesnt work so that Shine the creator of the LUA player can fix that.

When i type print("text") it hints to its sucess but fails in display. That obviously needs to be fixed. Since it is not working as inteded.

Now if it was removed then you would get the error

Quote:
Error: PATH/file.lua:(line): attempt to call global 'print' (a nil value)

Press start to restart
Back to top
View user's profile Send private message
romero126



Joined: 24 Dec 2005
Posts: 200

PostPosted: Thu Jun 08, 2006 4:01 pm    Post subject: Reply with quote

Furthermore here is a workarround for developers to use. (It works just like in dos)
Code:


IO_LIB = {
   x = 0,
   buffer = Image.createEmpty(480, 272),
   prebuffer = Image.createEmpty(480, 272)
}
function IO_LIB:PrintF(text)
   for i = 1, string.len(text) do
      char = string.sub(text, i, i)
      if char == "\n" then
         self.prebuffer:clear(Color.new(0, 0, 0))
         self.prebuffer:blit(0, -10, self.buffer, true)
         self.buffer:blit(0, 0, self.prebuffer, 0, 0, 480, 272, true)
         self.x = 0
      elseif char ~= "\r" then
         self.buffer:print(self.x, 264, char, Color.new(255,255,255))
         self.x = self.x + 8
      end
   end
   screen:blit(0, 0, self.buffer)
   screen.waitVblankStart()
   screen.flip()
end


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