I want to find out the smallest magnitude between let’s say point (point)
and 2 other positions, indexed first and second in this sample :
x = {
[1] = Vector3.new(2,2,2) ;
[2] = Vector3.new(1,1,1) ;
}
point = Vector3.new(2,2,5)--going to compare magnitudes of other positions with this one
for i = 1 ,#x do
ss = {}
table.insert(ss,((x[i]-point).Magnitude))
print(table.unpack(ss)-------> prints 2 magnitudes
for i = 1 , #ss do
f = math.min( ss[i],ss[i+1] )---trying to find the smallest number from 2 magnitudes
print(f)----> bad argument #2 (number expected, got nil)
end
end
Does any method exist to find the smallest number in a table containing numbers ?
If so, then some insight on this would be appreciated. (Not to compare values in a table using operators, but to find the minimum value)
Please excuse the lack of descriptive variables.