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 

Problems with adding a function to Image

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



Joined: 04 Mar 2006
Posts: 31

PostPosted: Mon Mar 26, 2007 9:07 am    Post subject: Problems with adding a function to Image Reply with quote

I've added a function to Image like this:
function Image:printb(x,y,str,clr)

and it works ok for images but it won't work for screen:printb. I get "attempt to call method 'printb' (a nil value" I have to explicitly write the exact same routine for screen like this:
function screen:printb(x,y,str,clr)

Seems like a waste as screen is supposed to be an Image right?

Here the really weird part: when i delete the screen:printb function and save it, Image:printb will work for screen. It's only until I quit Luaplayer and run it again that I get the same error again.

Can anyone help me out?
Back to top
View user's profile Send private message
the underminer



Joined: 03 Oct 2005
Posts: 124
Location: Netherlands

PostPosted: Tue Mar 27, 2007 6:44 pm    Post subject: Reply with quote

screen is a special type of image; and it has it's own functions like screen.flip() and screen:waitVblankstart(). That's why you have to specify the function for both Image and screen. I think that when you restart luaplayer by pressing the start button or something like that the screen set of functions won't be reset/reloaded so your function will remain to exist in memory. Only when you close luaplayer, the memory will be completely cleaned

Still, I didn't even know you could add functions to screen. Nice one.
_________________
Behold! The Underminer got hold of a PSP
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