[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: luaL_getn segfault
- From: Tuomo Valkonen <tuomov@...>
- Date: Tue, 29 Jul 2003 23:19:51 +0300
On Tue, Jul 29, 2003 at 01:51:42PM -0600, benjamin sunshine-hill wrote:
> I don't think LHF was suggesting you patch Lua. An application is responsible
> for ensuring that it fulfils the preconditions of library functions it calls.
Yeah, but the the checking is basically implemented, but not enabled (and
can be implemented much more efficiently there than in apps using the
library). Also primitive multithreading support is implemented, but not
enabled by default. In general, it seems like Lua packaging is more geared
towards embedding in proprietary software, where you can make the necessary
changes, than as a system-wide installed library where all the implemented
features are available when needed.
In addition, the API is not consistent with these requirements. All that
seems to be said in the manual is:
> 3.19 - Error Handling in C
""
Internally, Lua uses the C longjmp facility to handle errors. When Lua
faces any error (such as memory allocation errors, type errors, syntax
^^^^^^^^^^^
errors) it raises an error, that is, it does a long jump.
...
Almost any function in the API may raise an error, for instance due to a
memory allocation error.
""
> Check out lauxlib.h (and the documentation on the Wiki); lots of useful
> functions like this.
Nothing of use there except the checktype function.
--
Tuomo