[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Can lua_next() error?
- From: Dirk Laurie <dirk.laurie@...>
- Date: Mon, 16 Apr 2018 19:05:39 +0200
2018-04-16 18:49 GMT+02:00 Viacheslav Usov <email@example.com>:
> No, not really. It is one thing if a parameter in a C function is a pointer,
> then the argument simply has to point to a valid memory location. It is
> quite another when it is a kind of a "handle", then it is rather typical for
> a function to return an error result if the argument has an invalid or
> unsuitable value. See POSIX/read(), for example. Lua's stack indices look
> more like handles than pointers to me, but that, of course, can be just me.
The C API functions themselves do no type checking. The standard
library, wriiten using only the API, does it all the time. That should
serve as a model of what user functions based on the API should do. If
lua_next(), or any other API function, causes a crash, it is a bug in
the user program.