[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: luaopen_io() crash in Lua 5.1
- From: "jason zhang" <jzhang@...>
- Date: Tue, 22 Aug 2006 10:27:24 +0800
Hi,
In my project, I initialize the Lua interpreter in the WinMain function like below:
L = lua_open();
luaopen_base(L); /* opens the basic library */
luaopen_table(L); /* opens the table library */
luaopen_io(L); /* opens the io library */
luaopen_string(L); /* opens the string lib. */
luaopen_math(L); /* opens the math lib. */
When it run to the luaopen_io(L), a error raises. It's access violation.
>From the call stack, I found it crashed in
lapi.c:
static TValue *index2adr (lua_State *L, int idx)
case LUA_ENVIRONINDEX: {
Closure *func = curr_func(L);
sethvalue(L, &L->env, func->c.env); // -----> here
return &L->env;
call stack is:
LUA51! lua_remove line 64 + 16 bytes
LUA51! lua_replace line 203 + 12 bytes
LUA51! luaopen_io line 517
init_lua() line 24
WinMain(HINSTANCE__ * 0xc714e38e, HINSTANCE__ * 0x00000000, unsigned short * 0x1a04fe98, int 5) line 46 + 4 bytes
WinMainCRTStartup(HINSTANCE__ *, HINSTANCE__ * 0x00000000, unsigned short * 0x000500a8, int 328352) line 21 + 20 bytes
03f8922c()
The platform is WinXP, the compiler is VC6.
Could anybody teach me how to resolve this?
Regards,
Jason