You will have to ensure that you turn your spindle and coolant back on after the M101 is called.
But this should get you going.
function m101()
local inst = mc.mcGetInstance()
local m01 = mc.mcSignalGetHandle(inst, mc.OSIG_OPT_STOP)
local m01State = mc.mcSignalGetState(m01)
local CoolantOutput = mc.mcSignalGetHandle(inst, mc.OSIG_COOLANTON)
if m01State == 1 then
mc.mcSignalSetState(CoolantOutput, 0)
mc.mcSpindleSetDirection(inst, 0);
mc.mcCntlFeedHold(inst)
end--m101State
end
if (mc.mcInEditor() == 1) then
m101()
end