Here is a way to pass a Variable number of Params to a Lua function.
function VariableParamFunc(...)
local p1 = 0;
local p2 = 0;
local p3 = 0;
local mInst = 0;
local inst = mc.mcGetInstance(mInst);
p1, p2, p3 = select(1, ...);--this means start with the 1st param, and get
--all that is passed, in this case a max of three are passed, so p1-3
--receives them.
if p1 == nil then p1 = "nil"; end
if p2 == nil then p2 = "nil"; end
if p3 == nil then p3 = "nil"; end
mc.mcCntlSetLastError( inst,
"p1 = " .. tostring(p1)..
" p2 = ".. tostring(p2)..
" p3 = ".. tostring(p3));
end
if (mc.mcInEditor() == 1) then
VariableParamFunc();
VariableParamFunc(2,3,4);
end
--You can pass as many params as you want, by putting in the function
--variables that get them via the order them come in at.
--this example handles three.
The website screws up the formatting, so the file is attached.
Scott