lua-users home
lua-l archive

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


Hello,

What is wrong with the following code?

#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
int main()
{
        lua_State *L = lua_open();
        luaopen_base(L);
        luaopen_table(L);
        luaopen_io(L);
        luaopen_string(L);
        luaopen_math(L);
        return 0;
}

$ gcc -Wall -g luatest.c -llua
$ ./a.out
PANIC: unprotected error in call to Lua API (no calling environment)
$

#6  0xb7fabffe in luaD_throw (L=0x804a008, errcode=2) at ldo.c:106
#7  0xb7fabd49 in luaG_errormsg (L=0x804a008) at ldebug.c:611
#8  0xb7fabd9a in luaG_runerror (L=0x804a008, fmt=0xb7fc513b "no calling environment") at ldebug.c:620
#9  0xb7f9fdef in lua_replace (L=0x804a008, idx=-10001) at lapi.c:204
#10 0xb7fb172a in luaopen_io (L=0x804a008) at liolib.c:513
#11 0x0804858e in main () at luatest.c:10

lua-5.1.2

Attachment: pgp_STOpXUtpl.pgp
Description: PGP signature