Add math.lerp function

I actually support feature requests like these.

Implementing common math functions into the engine itself is way more efficient than writing it in Luau since in-engine code is much more performant.

Luau is a interpreted language that runs on a virtual machine most of the time.
And Native Luau doesn’t work it’s magic on everything all the time.

While we’re at it, having a function for reflecting/flipping Vectors and CFrames on a given axis would also be very nice to have.

3 Likes

Implement support for math.lerp by zeux · Pull Request #1608 · luau-lang/luau saw this today, someone implemented it and made a PR that got merged.

2 Likes

It is merged! It probably will come in the next week’s Studio release.

1 Like

It will be added to library soon because of release notes 656.

6 Likes

When it could be as simple as math.lerp(a, b, t), there’s no need to call it useless when it could be even simpler.

I may be wrong but isnt there a lerp function ?

It was just added in the most recent release notes.

3 Likes

Yea yea. No need to continue the argument further because yall already got it.

math.lerp isn’t useless because it can be written in one line! Loads of other math functions can be written on one line too.

function sin(x)
	return x - 0.16605*x^3 + 0.00761*x^5
end

print(math.sin(math.rad(10))) -- 0.173...
print(sin(math.rad(10))) -- 0.173...

print(math.sin(math.rad(50))) -- 0.766...
print(sin(math.rad(50))) -- 0.766...
1 Like

Can be fastcalled if it’s a triple arg function since version 6, and it is.

2 Likes

image
It exists in type checking from now (not implemented yet)