I'm trying to make a simple equation solver, and I get the following error:
"A" is a Number Value since I placed numbers only as Arguments. What am I doing wrong? Any and all help is appreciated.
local Equation = { C = 0; } function Equation.SolveForC(A,x,B,y) Equation.C = A(x) + B(y) print(Equation.C) end Equation.SolveForC(2,3,2,3)
The answer is simple: You did not use correct Lua formatting for multiplication. In Lua, it is only ever x * y, never x(y) or y(x). Here is the corrected code:
local Equation = { C = 0; } function Equation.SolveForC(A,x,B,y) Equation.C = A*x + B*y print(Equation.C) end Equation.SolveForC(2,3,2,3)
If this helped, please accept this answer.