[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Docs for lua_remove, lua_replace
- From: Albert Krewinkel <albert+lua@...>
- Date: Wed, 16 Feb 2022 19:28:33 +0100
Roberto Ierusalimschy <roberto@inf.puc-rio.br> writes:
>> The documentation for `lua_remove` and `lua_replace` indicates that both
>> will never trigger an error. However, their (macro) definitions use
>> lua_pop, which *can* raise an error in Lua 5.4. Therefore, I believe
>> that the function indicators should be `[-1, +0, e]` instead of
>> `[-1, +0, –]`.
>
> lua_pop can raise an error only when popping a to-be-closed slot.
> According to the documentation, a to-be-closed slot should only
> be removed by lua_pop or lua_settop; that is, 'lua_remove' and
> 'lua_replace' should not be used to remove a to-be-closed slot. So,
> if the API is used followind the documentation, 'lua_remove' and
> 'lua_replace' cannot raise errors.
Ah, thanks! I had missed that, even though it *is* right there in the
description of lua_toclose.
Sorry for the noise.
--
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124