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 

Colon or Period?

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



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

PostPosted: Mon Aug 29, 2005 4:55 am    Post subject: Colon or Period? Reply with quote

In the functions.txt file, many have colon and others, period. For example,
Code:
Image Image.load( filename )
nil Image:save( filename )

I am somewhat confused between them. Can anyone explain the difference?

It is hard to remember which to use colon or period without understanding why.

Thanks.
_________________
Geo Massar
Retired Engineer
Back to top
View user's profile Send private message Send e-mail
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Mon Aug 29, 2005 5:10 am    Post subject: Re: Colon or Period? Reply with quote

Dots are used for kind of static functions, without an object, and colons are used, when calling a function on an object. E.g. i=Image.load("test.png") creates an object and i:save("image.tga") saves it and is a short form for Image.save(i, "image.tga").
Back to top
View user's profile Send private message
KawaGeo



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

PostPosted: Mon Aug 29, 2005 6:46 am    Post subject: Reply with quote

Reply in a nutshell, indeed. :)

Thanks.
_________________
Geo Massar
Retired Engineer
Back to top
View user's profile Send private message Send e-mail
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Mon Aug 29, 2005 6:56 am    Post subject: Reply with quote

You can find the glory details in the Lua manual ( http://www.lua.org/manual/5.0/ ) and your dot and colon question at http://lua-users.org/wiki/SimpleLuaClasses . Lua Player uses something like the simple class model for Image, Music etc. internally, so it is not a pure Lua question, which is the reason why I didn't locked this thread :-)
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