|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 14 Feb 2016 01:46 PM |
| Oh okay. No its many sets that are the same color but its random. |
|
|
| Report Abuse |
|
|
|
| 14 Feb 2016 01:51 PM |
| I dont really see why this would be any different though. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|