I believe I found out what was causing the stack errors. I had made a FlyWithLua script to automatically assign 2 throttle quadrant levers to the condition levers. Apparently, there was too much code in the function that updates the condition lever datarefs. I trimmed it down to following and this seems to work.
dataref ("LEFTCONDITIONLEVER", "LES/saab/CL/manip_pos_L", "writable")
dataref ("RIGHTCONDITIONLEVER", "LES/saab/CL/manip_pos_R", "writable")
function SAAB340A_SetConditionLevers ()
LEFTCONDITIONLEVER = 1.0 - JOYSTICK_AXIS [62]
RIGHTCONDITIONLEVER = 1.0 - JOYSTICK_AXIS [61]
end
do_every_frame ("SAAB340A_SetConditionLevers ()")