generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Functions

Previous Thread :: Next Thread 
newcoolman2 is not online. newcoolman2
Joined: 01 Apr 2010
Total Posts: 2637
21 Aug 2016 04:47 PM
Is there a real reason for something like this:

local a={}
function a:r()
--stuff
end


Report Abuse
FrozenSmite is not online. FrozenSmite
Joined: 17 Jul 2013
Total Posts: 2242
21 Aug 2016 04:48 PM
modules
Report Abuse
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
21 Aug 2016 04:48 PM
OOP. When you do that the function has an implied first parameter called 'self' that holds a reference (or the value in the case of non-objects) to whatever it was called on:

a:r(z) is the same as: a.r(self, z)
Report Abuse
newcoolman2 is not online. newcoolman2
Joined: 01 Apr 2010
Total Posts: 2637
21 Aug 2016 04:50 PM
I don't really understand what that means.
would the function only be manipulating the table or could it be named like that and still do other stuff


Report Abuse
newcoolman2 is not online. newcoolman2
Joined: 01 Apr 2010
Total Posts: 2637
21 Aug 2016 04:51 PM
Oh thank you Flux


Report Abuse
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
21 Aug 2016 04:57 PM
Yeah. So when you call a method, the 'self' is actually the object it was called on:

part:Destroy() is virtually the same as: part.Destroy(part)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image