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

How many parameters can a function hold?

Asked by 10 years ago

What is the maximum amount of parameters that a function can hold? Like this:

function lel(var1, var2, var3, etc) --Here
end

2 answers

Log in to vote
3
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago

I believe you can have an infinite amount. By the way, those variables are referred to as Parameters.

0
So that's what it's called! I knew the word, I just couldn't put my finger on what it was. Thanks very much! Aesthetical 100 — 10y
2
Not so much as infinite as it is just really really big. You eventually probably will run out, but that number is so high that you shouldn't need to worry about it. User#2 0 — 10y
0
IIRC, it's equivalent to the number of available addresses RBX.Lua can use. That or the largest unsigned int value on the server. Either way, really big. adark 5487 — 10y
Ad
Log in to vote
1
Answered by
TheMyrco 375 Moderation Voter
10 years ago

Actually, there is a limit: 200.

It's not hard to explain this, really. The limit of the amount of local variables is 200. Parameters are seen as local variables.

I thought this, but was unsure if it really was true, so I conducted a test. Here's the code if you'd like to see what I mean (P.S: No, I didn't type the var1 to var201 parameters, I used the cmd bar to print them out):

function x(var1, var2, var3, var4, var5, var6, var7, var8, var9, var10, var11, var12, var13, var14, var15, var16, var17, var18, var19, var20, var21, var22, var23, var24, var25, var26, var27, var28, var29, var30, var31, var32, var33, var34, var35, var36, var37, var38, var39, var40, var41, var42, var43, var44, var45, var46, var47, var48, var49, var50, var51, var52, var53, var54, var55, var56, var57, var58, var59, var60, var61, var62, var63, var64, var65, var66, var67, var68, var69, var70, var71, var72, var73, var74, var75, var76, var77, var78, var79, var80, var81, var82, var83, var84, var85, var86, var87, var88, var89, var90, var91, var92, var93, var94, var95, var96, var97, var98, var99, var100, var101, var102, var103, var104, var105, var106, var107, var108, var109, var110, var111, var112, var113, var114, var115, var116, var117, var118, var119, var120, var121, var122, var123, var124, var125, var126, var127, var128, var129, var130, var131, var132, var133, var134, var135, var136, var137, var138, var139, var140, var141, var142, var143, var144, var145, var146, var147, var148, var149, var150, var151, var152, var153, var154, var155, var156, var157, var158, var159, var160, var161, var162, var163, var164, var165, var166, var167, var168, var169, var170, var171, var172, var173, var174, var175, var176, var177, var178, var179, var180, var181, var182, var183, var184, var185, var186, var187, var188, var189, var190, var191, var192, var193, var194, var195, var196, var197, var198, var199, var200, var201)
    print("hi") 
end

x()

Answer this question