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.
The original circuit is a "low-side" current sense. The first variant is a voltage source with a high-side current sense. The second variant is the same but is now adjustable (tweak trip current). The third variant replaces the two diodes with a transistor to make it a little more precise. All these circuits are not going to be very precise as the Vbe junction of any transistor is sloppy and changes a lot of temperature. The low side vs high side just depends on your application (maybe you don't have access to the high-side).
The three transistor version is going to be the most precise and give you adjustments to trim some error and tune the current trip level.
Best Answer
The LM317 adjusts the output current so that the voltage between the OUTPUT and ADJUST pins is 1.25 V. This reference voltage is compensated against temperature and current variations.
In the transistor circuit, the reference voltage is based on the voltage drop over the base/emitter junction of Q2. It's usually 0.65 V, but will change with temperature (you could use it as a temperature sensor). Futhermore, a plain transistor is not designed as a voltage reference, so different transistors will have manufacturing variations.
The LM317 is rated for 40 V; plain transistors are available with higher ratings, and are more robust in general.
To make the transistor circuit more stable, replace Q2 with a shunt voltage reference such as the widely-used and cheap TL431 (2.5 V) or TLV431 (1.25 V). It might be possible to create a stable voltage reference from discrete parts, but it is unlikely that that would be cheaper:
source: TL431 datasheet
Anyway, for driving LEDs, the increased stability might not matter.