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: What are constructors?

Previous Thread :: Next Thread 
bosswalrus is not online. bosswalrus
Joined: 04 Jan 2013
Total Posts: 5430
09 Feb 2015 09:42 AM
What are they and how are they used?
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
09 Feb 2015 09:46 AM
Constructors are those things like Instance.new, or Vector3.new

You don't really have to worry about the whole 'constructors' idea until you start working with C and similar languages.
Report Abuse
bosswalrus is not online. bosswalrus
Joined: 04 Jan 2013
Total Posts: 5430
09 Feb 2015 09:48 AM
I see, it's just that I remember them from this guy's Java tutorials and I didn't understand them.
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
09 Feb 2015 09:49 AM
They're an OOP concept, and you'll get them a lot on C#, Java, and similarly built OOP related languages.
Report Abuse
bosswalrus is not online. bosswalrus
Joined: 04 Jan 2013
Total Posts: 5430
09 Feb 2015 09:51 AM
Alright, thanks.
Report Abuse
LucasLua is not online. LucasLua
Joined: 18 Jun 2008
Total Posts: 7386
09 Feb 2015 09:53 AM
In Java constructors are used to make objects from classes. Constructors set instance variables based on input.

In Lua you can create a similar concept using tables and metamethods but unless you are dead set on using it constantly you'll wind up switching back to the procedural paradigm. Check out the "MiddleClass" git on github by kikito to set up Object Oriented Lua.

OO Lua comes in handy when using LOVE2D but not Roblox because of Roblox already having objects made for you.
Report Abuse
DerProgrammierer is not online. DerProgrammierer
Joined: 16 Aug 2007
Total Posts: 12992
09 Feb 2015 09:59 AM
You could think of it similar to the Main method. Except rather than an overall program starting point, it's a class's starting point. You use constructor methods to set up variables (if any) and call additional methods (if needed).
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