LM317 current limiter, driving with uC
The point of the current limiter is that, if the current is higher than desired, it will reduce voltage, which with most Ohmic loads will reduce the current draw.

This uses the fact that voltage drop == resistance times current, and the regulator reduces voltage if it sees a voltage on the reference pin that is greater than the reference (1.2V? something like that)

Does this mean that the voltage out from the current limiter is at least 1.2V less than the input? Yes, it does!

However, if you have a microcontroller, and don't need "immediate" feedback (your uC response time is OK) then you can simply sample the voltage drop across a current sense resistor (something small like 0.1 Ohms) to estimate current, and drive any variable resistor, like a regular power transistor, using an analog output from your uC (or a filtered PWM.)

You probably want another solution, like an existing programmable potentiometer in the feedback loop of an opamp, for example. Use a current sense resistor that's small (0.1 Ohms?) and program the amplification of the voltage drop using an opamp. When amplification is 10x, then you get to 1.2 volts at 1.2 amps; when the amplification is 100x, then you get to 1.2 volts at 120 mA.