What is "+5 overloads"?

I was writing some code and I was about to write CFrame.new() when I noticed the documentation thing says +5 overloads. What does that mean and why does it show up? Sometimes i see it on other things with .new() and the number of overloads is different.

It is probably a reference to how many types of arguments in how many ways you can input into that function. In the case of CFrame.new, it has 6 total ways. (It shows +5 because leaving it empty is also a way.)

Hope that made sense.

1 Like

overload means a function with the same name but different parameters
the parameters you put in determine which one gets called

local function funcExample(a : String) 
  print(a)
end

local function funcExample(b : number)
  print(b + 15)
end
2 Likes

If you can have the same method name with multiple argument lists, that method is said to be overloaded. Not to be confused with overriding. Each combination of arguments can run different code, so be careful when editing that you don’t accidentally change the number of arguments, which is a very easy mistake to make with CFrame.new.

Be careful as this does not actually work in Lua. The overloads are possible for CFrame.new because it is engine code, calling is handled differently.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.