|
| 14 Oct 2012 09:19 PM |
| can some one help explain it to me? |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
| |
|
|
| 14 Oct 2012 09:32 PM |
Does that mean you don't get it?
-[::ƧѡÎḾḠΰῩ::]-[::Maker of stuff and Helper of Scripting::]- |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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 |
|
|
|
| 14 Oct 2012 10:07 PM |
| i think i dont understand it because im only 8 yrs old lol |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 14 Oct 2012 11:26 PM |
| @cnt, you don't have to connect every function... |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|