In Lua documentation, calling :seek() on a file object is supposed to return how much data has been read through the file. However, when I call this method on stdin it does not return consistent numbers.
When I open terminal and run the Lua REPL and execute io.stdin:seek()
I get random numbers. In one tab I might get:
Lua 5.2.0 Copyright (C) 1994-2011 Lua.org, PUC-Rio
> =io.stdin:seek()
2091
In another tab I could get instead:
Lua 5.2.0 Copyright (C) 1994-2011 Lua.org, PUC-Rio
> =io.stdin:seek()
486
What explains this behaviour whereby calling seek() on stdin returns a number that seems to have no relevance to how much input Lua has received?
And how else might I be able to retrieve how much data has been read through stdin?