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: Parameters

Previous Thread :: Next Thread 
myactivetestplace is not online. myactivetestplace
Joined: 11 Jul 2015
Total Posts: 3733
14 Feb 2016 01:33 PM
Why is it necessary to specify what were going to use in the function before we use it?
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
14 Feb 2016 01:37 PM
The parameters?
Well it doesn't really make sense otherwise:


#code
function DoStuff()
print(--[[ What to print? No parameters were assigned! D: Idk what to do D: ]])
-- Sure, we could have printed 7.3, but how were we to know that 7.3 was the input?
end
DoStuff(7.3)


-- Try this:

function DoMoreStuff(Input)
print(Input) -- Hey, we have an input!
end
DoMoreStuff(7.3)
DoMoreStuff(10)


Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
14 Feb 2016 01:38 PM
Without arguments and parameters, you could do print("Lol hi thar"), but it won't do anything since arguments and parameters are useless. It has no input.


Report Abuse
myactivetestplace is not online. myactivetestplace
Joined: 11 Jul 2015
Total Posts: 3733
14 Feb 2016 01:44 PM
Its like this in the roblox trowel.

function placeBrick(cf, pos, color)--As if they specified that were going to use a variable "color" here
local brick = Instance.new("Part")
brick.BrickColor = color - Here they say make it "color"
brick.CFrame = cf * CFrame.new(pos + brick.Size / 2)
script.Parent.BrickCleanup:Clone().Parent = brick -- attach cleanup script to this brick
brick.BrickCleanup.Disabled = false
brick.Parent = game.Workspace
brick:MakeJoints()
return brick, pos + brick.Size
end

function buildWall(cf)
local color = BrickColor.random()-- Then here they specify that they want it to be random.
local bricks = {}

couldnt they have just:


brick.BrickColor = BrickColor.random()
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
14 Feb 2016 01:45 PM
Because is the whole wall random? Or is the whole wall just one color that was random?

Because sure, if each individual block is random, then they could have done it the other way.


Report Abuse
myactivetestplace is not online. myactivetestplace
Joined: 11 Jul 2015
Total Posts: 3733
14 Feb 2016 01:46 PM
Oh okay. No its many sets that are the same color but its random.
Report Abuse
myactivetestplace is not online. myactivetestplace
Joined: 11 Jul 2015
Total Posts: 3733
14 Feb 2016 01:51 PM
I dont really see why this would be any different though.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
14 Feb 2016 01:52 PM
Because the whole wall is one color, right?

Try it your way. Define color inside of the function as a random brick color. Each block that is placed will be a different color.


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