Modifying the dot printing routine to call lua seems to work:

Code
char buffer[128];
snprintf(buffer,128,"if drawdot then drawdot( %f, %f ) end",
           (double) m_real_cr_pos + CR_OFFSET, yd);
callloadstring( buffer );

I use the if to check if the drawdot routine has been defined.

Code
Trying callloadstring if drawdot then drawdot( 971.000000, 170.333333 ) end
Trying callloadstring if drawdot then drawdot( 971.000000, 171.333333 ) end
Trying callloadstring if drawdot then drawdot( 971.000000, 172.333333 ) end
Trying callloadstring if drawdot then drawdot( 971.000000, 173.333333 ) end
Trying callloadstring if drawdot then drawdot( 971.000000, 174.333333 ) end


and if I define the drawdot routine from the console:

Code
function drawdot(x,y) print("DRAWDOT !!! "..x.."  "..y) end

Trying callloadstring if drawdot then drawdot( 35.000000, 60.000000 ) end
DRAWDOT !!! 35.0  60.0
Trying callloadstring if drawdot then drawdot( 35.000000, 61.000000 ) end
DRAWDOT !!! 35.0  61.0

Now I need to figure out how the ap2000 does 240 dpi because the steppers seem to step at 120 dpi, perhaps you have to watch the timing of when the printhead is fired, firing it when it's moving in-between stepper positions.