[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: luaL_buffinit stack manipulation
- From: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 8 Jul 2021 10:39:41 -0300
> In previous versions, the luaL_Buffer functions would push a (full)
> userdata, or in older versions possibly multiple full userdatas, onto
> the stack at some unpredictable point. Hence the warnings about balanced
> stack usage when using luaL_Buffer in the documentation.
> This interface has been a _major_ cause of subtle bugs even for
> experienced programmers (there are many examples in the list archives),
I would like to emphasize this point. Often, code that has problems
with this new implementation in 5.4.3 was already bugged for older Lua
versions, but the bug only happened when the buffer got sufficiently
large, and so the bug could go unnoticed.
> Benoit> However, the documentation for the function is [-0, +0, –] ,
> Benoit> meaning we should not expect anything to be pushed on the
> Benoit> stack, nor any error raised. Also, API incompatibility doesn't
> Benoit> say anything about it either.
> That may qualify as a documentation bug; [-0, +?, -] would be more