Method Stdio.Buffer()->range_error()
- Method range_error
protectedrange_error(boolinthowmuch)- Description
This function is called when an attempt is made to read out of bounds.
The default implementation simply returns
0(zero).Override this function to change the behavior.
- Parameter
howmuch The argument
howmuchindicates how much data is needed:(1..)Need
howmuchbytes more0The amount of data needed is not certain. This most often happens when sscanf or read_json is used
(..-1)Tried to unread -
howmuchbytes. There is usually no way to satisfy the requested range.The only supported way is to extract the data from the buffer, add the requested amount of "go backbuffer", add the data back, and forward -
howmuchbytes.- Returns
trueif the operation should be retried,falseotherwise.Do not return true unless you have added data to the buffer, doing so could result in an infinite loop (since no data is added, the range_error will be called again immediately).