function VectorFieldControl.createVectors(scaleX, scaleY, scaleZ, func)
	for i=1, scaleX do
		for j=1, scaleY do
			for k=1, scaleZ do
				local x = (scaleX/2)*(-1)+i * pi
				local y = (scaleY/2)*(-1)+j * pi
				local z = (scaleZ/2)*(-1)+k * pi
					
				local Vector = CFrame.new(Vector3.new((scaleX/2)*(-1)+i, (scaleY/2)*(-1)+j, (scaleZ/2)*(-1)+k)) * CFrame.fromAxisAngle(Vector3.new(func(x, y, z)), 1)
				table.insert(VectorField, i, Vector)
			end
		end
	end
end

func contains a mathematical function, in a string value, that can be anything that works with Lua's operators. I want to be able to calculate the results.

An example of an equation that would be in the variable (func):

f(x,y,z)=[sigma * (y - x), rho * x - y - x * z, x * y - beta * z]

Common constants are set earlier in the script

how I would want the script to treat it:

written as:

func(a,b,c)

Calculated as:

sigma * (b - a), rho * a - b - a * c, a * b - beta * c

~ Note: This can be written in anyway in the script, so it doesnt have to strictly adhear to the example I provide. As long as it uses the same input and has the same results I'm good.

1 comment

0

You will have to create a string parser