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
 

What are 'Arguments'

Previous Thread :: Next Thread 
TheShoeBox is not online. TheShoeBox
Joined: 20 Aug 2010
Total Posts: 5022
06 Feb 2012 10:06 PM
I'm confused.

I was reading the Wiki to get better with functions, and it randomly adds arguments in. What are they for? What do they do?
Report Abuse
Riderj is not online. Riderj
Joined: 15 Aug 2011
Total Posts: 1534
06 Feb 2012 10:07 PM
They add functionality to a function.Here is an example of a function with arguments:


function add(num,num2)
return num+num2
end

print(add(1,2))

That will print 3, arguments are basically variables that are stated when you call the function.

[=|I rate myself 6.5/10 in RBLX.Lua|=]
Report Abuse
Zarcius is not online. Zarcius
Joined: 08 Dec 2007
Total Posts: 3024
06 Feb 2012 10:08 PM
Arguments are things used as conditionals to pass a function.

workspace.Bob.Torso.Touched:connect(function(hit) --[[Here, hit is an argument.]]
if hit.Parent.Name == "Steve" then
print("Steve says: /""Hello, Bob!/""")
else print("Go away!")
end)

I think this is correct.
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
06 Feb 2012 10:09 PM
function a(arg1,arg2) --these are called arguments
print(arg1,arg2)
end

a("b","c")
>b    c

function a(...) --this is argument
local arg={...} --usually this wouldn't be needed, but roblox doesn't support arg
print(unpack(arg))
end

a("b","c","d")
>b    c    d

­<'+1 Post. Ujelly?'>
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
06 Feb 2012 10:09 PM
http://www.roblox.com/Forum/ShowPost.aspx?PostID=62145553
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
06 Feb 2012 10:10 PM
Look at this for better reference

http://wiki.roblox.com/index.php/Arguments_and_Parameters

­<'+1 Post. Ujelly?'>
Report Abuse
Zarcius is not online. Zarcius
Joined: 08 Dec 2007
Total Posts: 3024
06 Feb 2012 10:10 PM
AFF, will you answer my thread pl0x? :3
Report Abuse
LuisPambid is not online. LuisPambid
Joined: 31 Mar 2011
Total Posts: 532
07 Feb 2012 05:22 AM
Actually,

function Test(P) --This is a Parameter.
return P
end

print(Test("Cool")) --This is a Argument.
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
07 Feb 2012 06:30 AM
That is correct, however, most people just call the parameters inside the function arguments, mainly because it doesn't get as confusing.

­<'+1 Post. Ujelly?'>
Report Abuse
LuisPambid is not online. LuisPambid
Joined: 31 Mar 2011
Total Posts: 532
08 Feb 2012 03:20 AM
:L
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
08 Feb 2012 04:32 AM
[ Content Deleted ]
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