Ok, here is an Example that shows what is going on, with returning multiple "return values"
the "StopVarForDebugging" in the code, is where you can put a break point in the mcLua debugger when using "F5" to see what the value of everything is.
the function in the example, had the numbers: 2, 3, 5 as parameters passed to it
inside the function it doubles those values, and returns each on individually at double it's value.
I will post the code here, (but the web format will make it look jacked up), and I will attach the code as a .mcs file you can open in NotePad ++ or the editor you use.
function DoubleEachParamInput(NumberParam1, NumberParam2, NumberParam3)
local mInst = 0;
local inst = mc.mcGetInstance(mInst);
local localP1 = NumberParam1; --you could skip this step
local localP2 = NumberParam2; --and just test the Params
local localP3 = NumberParam3; --in the error code below directly
local localRV1 = 0; --local return value 1
local localRV2 = 0; --local return value 1
local localRV3 = 0; --local return value 1
if localP1 == nil then localP1 = 0; end --simple error checking code
if localP2 == nil then localP2 = 0; end --simple error checking code
if localP3 == nil then localP3 = 0; end --simple error checking code
localRV1 = (localP1 * 2);--double param 1
localRV2 = (localP2 * 2);--double param 2
localRV3 = (localP3 * 2);--double param 3
wx.wxMessageBox("Func internal RVs are:\r\n" ..
"localRV1 = " .. localRV1 .. "\r\n" ..
"localRV2 = " .. localRV2 .. "\r\n" ..
"localRV3 = " .. localRV3);
local StopVarForDebugging = 0;--(F5 debugging var)
return localRV1, localRV2, localRV3;
end
if (mc.mcInEditor() == 1) then
local RV1 = 0; --RV1 = Return Value 1
local RV2 = 0; --RV2 = Return Value 2
local RV3 = 0; --RV3 = Return Value 3
RV1, RV2, RV3 = DoubleEachParamInput(2,3,5);--Pass 3 number params
wx.wxMessageBox("RETURNED VALUES are:\r\n" ..
"RV1 = " .. RV1 .. "\r\n" ..
"RV2 = " .. RV2 .. "\r\n" ..
"RV3 = " .. RV3);
local StopVarForDebugging = 0;--(F5 debugging var)
end
Enjoy, Scott