problem persists...
tried some different things. After looking into some other code with a toggle button, i ended with this as a result. (artsoft tostring)
Return codes, still trying to grasp them...
function zControl.CheckSpindle()
	local axisID, rc = mc.mcMotorGetAxis(inst,Spindle) --Z axis maakt deel uit van variable rc om return code te bekomen
	local h_OUTPUT4 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT4)
	local state = mc.mcSignalGetState(h_OUTPUT4)
	local rcode = scr.SetProperty('togRouterSpindle', 'Button State', tostring(0))
	if rcode~=0 then
		mc.mcCntlSetLastError (inst, "check screen error state"..rcode)
	end
	
	if ((axisID == mc.Z_AXIS) and (state == 1) and (rc==mc.MERROR_NOERROR)) then --If Zaxis is loaded with motor 2 spindle is active
			mc.mcCntlSetLastError(inst, "Spindle already active, No swap required")	
			--scr.SetProperty('togRouterSpindle', 'Button State', tostring(0))
		else zControl.UseSpindle()
	end
end