[Iup-users] PANIC: unprotected error in call to Lua API (no calling environment)

Jeremy Cowgar jeremy at cowgar.com
Tue Dec 4 11:20:02 GMT+3 2007


This happens in my first ever Lua trial... Here's my C code:


#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>

#include <iup.h>
#include <iupcontrols.h>

#include <iuplua.h>
#include <iupluacontrols.h>

lua_State *L;

int main(void)
{
    IupOpen();
    IupControlsOpen();

    /* Lua 5 initialization */
    L = lua_open();  
    luaopen_base(L);
    luaopen_table(L);
    luaopen_io(L);
    luaopen_string(L);
    luaopen_math(L);

    iuplua_open(L);         /* Initialize Binding Lua */
    iupcontrolslua_open(L); /* Inicialize CPI controls binding Lua */

    /* do other things, like running a lua script */
    #include "mainwindow.loh"

    IupMainLoop();

    lua_close(L);

    IupControlsClose();
    IupClose();

    return 0;
}

And my mainwindow.lua file:

text = iup.text{ EXPAND = "YES" }
btn = iup.button{ title = "Hello World" }
dlg = iup.dialog{ iup.vbox{ text, btn }; title = "Hello World", resize = 
"YES", menubox = "NO", maxbox = "NO", minbox = "NO" }
dlg:showxy( iup.CENTER, iup.CENTER)


I then did:
luac5.1 -o mainwindow.lo mainwindow.lua
bin2c5.1 mainwindow.lo > mainwindow.loh

Any thoughts?

Jeremy Cowgar




More information about the iup-users mailing list