lua-users home
lua-l archive

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


Taco Hoekwater wrote:
> Somehow I can not get the new version of lpeg.c to link 
> statically (I had not problems with the previous two versions).
> 
> The C compile runs fine, but when I try to run the executable 
> I always get this error from within luaopen_lpeg():
> 
>    PANIC: unprotected error in call to Lua API (no calling 
> environment)
> 
> Can someone please help me? I am probably missing something 
> obvious, I simply do not understand what is happening. I 
> could find out that the problem is from the lua_replace() 
> line below, but that does not make it any clearer to me. 
> There is a similar-looking (to me) construct in liolib.c, 
> where it gives no trouble at all.
> 
>    int luaopen_lpeg (lua_State *L) {
>      lua_newtable(L);
>      lua_replace(L, LUA_ENVIRONINDEX);  /* HERE */
> 
> 
> Thanks in advance for any pointers,

Do you call luaopen_lpeg directly yourself or do you properly push it on
a Lua stack and lua_call it ? I think the latter is required.