I believe the state must be 'idle' for the axes to be homed. Therefore you will not be able to use your code in an mcode. If you use the following code in your m100 script and run it, you will most likely get a return value of -18. This is error: MERROR_NOT_NOW - The operation could not be completed at this time.
function m100()
--home material and arm
local inst = mc.mcGetInstance()
local rc = mc.mcAxisHome(inst, 0)
mc.mcCntlSetLastError(inst, tostring(rc))
end
if (mc.mcInEditor() == 1) then
m100()
end