Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Could somebody please give me some help with the topic Parameters & Arguments ?

Asked by 4 years ago
Edited 4 years ago

because i really do not understand it and it's the only thing in roblox studio that i have learnt so far , do not understand and i want to do something a bit like this code:

function addition(number1,number2) print (number1+number2) end

addition(3,4)

so that is what i want to do and if you reply please make it simple to read because i only know a handful of stuff about roblox studio and if you can can you please give me some beginner tips

thanks

0
uhh :FindFirstChild(Arguments) and local function randomfunction(Parameters) Nguyenlegiahung 1091 — 4y
0
could you explain that in sipler form please as i am only a beginner? bigkiddo27 6 — 4y
0
*simpler bigkiddo27 6 — 4y
0
Ummm what I suggest is searching up Roblox education and going through that series thing it helps it is step by step so do that. Phyrixia 51 — 4y
0
how i can only find how to make a story game bigkiddo27 6 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

so basically a Parameter or an Argument is what's inside the two () of a function

so like

function functionName(argument1, argument2)
    --argument1 and 2 can only be used inside this function
end
function functionName(argument1)
    --Argument 1 can be used here
end

--But not here

So think of it like this...

A person1 (the function caller) wants person2 (the function) to do a simple addition something...But function 2 wants numbers (the arguments) first before doing the addition...Person1 gave (passed) him 5 and 2, so person2 did 5 + 2 and gave *(returned) *him the answer...

so in lua it would look like this

function add(a, b)
    return a + b
end

print(add(5, 2))

I know it's confusing... But the simplest way I could explain arguments or parameters is that it's what a function needs

Edit: If you have questions, feel free to ask them

0
ok that expll[ination was really clear thanks for that! bigkiddo27 6 — 4y
0
welcome! TheBigBro122 427 — 4y
0
no questions needed! bigkiddo27 6 — 4y
Ad

Answer this question