something else you can use is mc.X_AXIS, mc.Y_AXIS etc to specify which axis you want. it makes your code more legible.
function autoSoftLimitsToggle (togglevalue)
local rc = 0
for i=0, 11 do
if mc.mcAxisIsEnabled (inst,i) == 1 then mc.mcSoftLimitSetState (inst,i,togglevalue) end
end
end
autoSoftLimitsToggle(1)