diff --git a/src/script.c b/src/script.c index 6b99ec2..41a415b 100644 --- a/src/script.c +++ b/src/script.c @@ -265,6 +265,9 @@ static int expect(lua_State *L) int ret = 0; char c; + // Resets buffer to ignore previous `expect` calls + buffer_size = 0; + if ((string == NULL) || (timeout < 0)) { ret = -1;