lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Tue, Apr 17, 2018 at 1:51 AM, Soni "They/Them" L. <fakedme@gmail.com> wrote:

> As far as the Lua C API is concerned, stack values are function arguments.

In the C standard, the definition of 'argument' is certainly not dependent on Lua's stack values.

In the standard C library API, an effort is made to warn the user of undefined behavior when an argument is valid at the basic C level, but semantically it is not. For example, fopen(): "The argument mode points to a string. If the string is one of the following, the file is open in the indicated mode. Otherwise, the behavior is undefined."

Compare that with the current note for lua_tointegerx(): "The Lua value must be an integer, or a number or string convertible to an integer (see §3.4.3); otherwise, lua_tointegerx returns 0", and then compare with an imaginary note for lua_next(): "The value at the given index must be a table; otherwise, the behavior is undefined".

Cheers,
V.