OT: 'best' dynamic language
Igor Sysoev
is at rambler-co.ru
Sat Apr 26 19:57:43 MSD 2008
On Sat, Apr 26, 2008 at 05:28:38PM +0200, Manlio Perillo wrote:
> Manlio Perillo ha scritto:
> >[...]
> >I have written a small program and I can confirm that opened files are
> >correctly closed when the Lua interpreter is finalized.
> >
> >The program is attached: the Lua code simply open a big file and read
> >all its content in memory.
> >
> >There is a custom memory allocator that make sure to fail when a large
> >amount of memory is required.
> >
> >
> >There is a strange behaviour, however.
> >The status code returned by luaL_dostring should be
> >4 (LUA_ERRMEM), instead 1 is returned.
> >
>
> Ok, solved.
>
> The last luaL_dostring should be replaced with:
>
> status = luaL_loadstring(L, CHUNCK_2);
> if (status != 0) {
> printf("syntax error in CHUNK_2\n");
> return EXIT_FAILURE;
> }
>
> status = lua_pcall(L, 0, 0, 0);
> msg = lua_tolstring(L, 1, &len);
> printf("execution status 2: %i:%s\n", status, msg);
>
>
> since luaL_dostring always returns 1 in case of errors.
>
>
> Updated code is here: http://rafb.net/p/yOVhjw87.html
Thank you for your investigation. I will look Lua.
--
Igor Sysoev
http://sysoev.ru/en/
More information about the nginx
mailing list