implement stack printing and other functions in lua