fix a bug in lua console implementation

I think that without this, if tab completion is pressed many times
it might cause the lua stack to overflow in some cases.