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 » Scripting Helpers
Home Search
 

Re: i just dont get custom functions

Previous Thread :: Next Thread 
awsomecoolguy1232 is not online. awsomecoolguy1232
Joined: 01 Aug 2012
Total Posts: 477
14 Oct 2012 09:19 PM
can some one help explain it to me?
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
14 Oct 2012 09:29 PM
function PrintStuff(stuff) --Creates a function named PrintStuff with argument 'stuff'
print(stuff) --Prints the argument
end

PrintStuff("Ohai") --Tells the script to run the function, and sets 'stuff' to "Ohai". This results in Ohai being printed.

-[::ƧѡÎḾḠΰῩ::]-[::Maker of stuff and Helper of Scripting::]-
Report Abuse
awsomecoolguy1232 is not online. awsomecoolguy1232
Joined: 01 Aug 2012
Total Posts: 477
14 Oct 2012 09:30 PM
qq
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
14 Oct 2012 09:32 PM
Does that mean you don't get it?

-[::ƧѡÎḾḠΰῩ::]-[::Maker of stuff and Helper of Scripting::]-
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
14 Oct 2012 09:32 PM
A custom function is a made-up function that is used later on in the script to call. Saves lots of lines of code depending on how many instructions you have in that function.

Swimguy gave you an example on that note.
Report Abuse
crazyman32 is not online. crazyman32
Joined: 13 Apr 2008
Total Posts: 18027
14 Oct 2012 09:51 PM
In MATH, you input a number and it spits out a manipulated form of that number. For example:


f(x) = 3x+10
f(4) = 3(4)+10 =12+10 =22

Functions in programming are similar, for you input something and usually expect a result. In fact, we can do the exact same math concept above in Lua code:



function f(x)
return 3*x+10
end

print( f(4) )

> 22
Report Abuse
awsomecoolguy1232 is not online. awsomecoolguy1232
Joined: 01 Aug 2012
Total Posts: 477
14 Oct 2012 10:07 PM
i think i dont understand it because im only 8 yrs old lol
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
14 Oct 2012 11:20 PM
function [Name](arg1, arg2, etc)
end

Event:connect([Name])
Report Abuse
thedeathmaster01 is not online. thedeathmaster01
Joined: 14 Mar 2010
Total Posts: 6331
14 Oct 2012 11:26 PM
@cnt, you don't have to connect every function...
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
14 Oct 2012 11:35 PM
IK
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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