
Hang on, unlike other languages a function can return different number of arguments depending on input. Now print isn't picky about arguments as it is just outputting them to std out. However, if you had a function that required x and y for some parabolic eqn, things could get messy if x relied on a fn that returned two values when x was negative.I'm not sure I understand your point. In my mind, if I have two functions returning 2 values, then I have 4 values plain and simple. It would be treated exactly the same as print(1,2,3,4). Is there a reasonnot to do it that way?
local calcX calcX = function(b) if b<0 then return calcX(b),"Warning Negative Fixed" end else return math.sqrt(b) end end for x=10,10 do plot(calcX(x),10) end You don't want returns mucking up input arguments