lua-users home
lua-l archive

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


As I pointed out you need to use luaL_openlibs()

On 11/12/05, Henderson, Michael D <michael.d.henderson@lmco.com> wrote:
>
> I just compared to the code that I used in 5.0.2 and now I'm confused. In
> 5.0.2 I didn't check the return codes of the functions, I just assumed that
> they always succeed (I basically use the example from PIL). For some reason
> I updated main.c for 5.1. So, please ignore the main.c I copied in the
> original message.
>
> I changed the main.c code back to my 5.0.2 version.
>
>     if (!L) {
>       fprintf(stdout, "error:\tunable to initialize Lua VM\n");
>       exit(2);
>     }
>     luaopen_base(L);             // opens the basic library
>     luaopen_table(L);            // opens the table library
>     luaopen_io(L);               // opens the I/O library
>     luaopen_string(L);           // opens the string lib
>     luaopen_math(L);             // opens the math lib
>
> I compiled and linked with 5.0.2. It runs. I recompiled and relinked with
> 5.1-beta. It abended as noted below.
>
> Mike
>
>
> -----Original Message-----
> From: lua-bounces@bazar2.conectiva.com.br
> [mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of
> Henderson, Michael D
>
>
>
> I downloaded and installed lua-5.1-beta-rc.tar.gz. When I try to open up the
> io library using "luaopen_io(L)" the application has a segmentation fault.
> The application does not seg fault when linked with 5.0.2.
>
> The line that seems to be causing the error is in src/liolib.c:
>   lua_replace(L, LUA_ENVIRONINDEX);
>
> I'm using gcc 4.0.0 on SunOS 5.8.