You won't be able to use the code from JayClascoe as it works with functions and yours is a set of points. Assuming FPrate
has x values for x coordinate sorted and TPrate
has corresponding values, you can use Trapezoidal rule. Something like this may work:
local area = 0
for i = 2, n do
area = area + (FPrate[i] - FPrate[i-1]) * (TPrate[i-1] + TPrate[i])/2
end