I don't see anything immediately wrong with your code. But I don't
think it is complete, I assume that in the Lua program you have the
line:

require("wx")

The program should show the two frames, the program "hangs" in the
wxWidgets event loop until you close them by hand and then your
probandoLua function is called.

Can you debug it? What platform? Did you compile everything,
wxWidgets, wxLua, Lua, etc all on your system or are you using
somebody's else's binaries? You note that you had to change the Lua
from 5.1.4... but I'm not sure I understand what you mean by that. The
crash could be because you linked against different versions of Lua
perhaps?

Regards,
    John


2008/11/22 Raúl Huertas <[EMAIL PROTECTED]>:
> Hi!
>
> I've been using Lua 5.1.4 and lua_close never failed. Then I started to play
> with wxLua, and works great. The problem is that a call to lua_close(), when
> lua have loaded the wxLua module ,makes the aplication crash, a core dump.
> This is the lua file:
>
>
> function probandoLua( a, b  )
>     print("Esta es la función de prueba Lua", a, b)
>
> end
>
>
>
> frame = wx.wxFrame( wx.NULL,            -- no parent for toplevel windows
>                     wx.wxID_ANY,          -- don't need a wxWindow ID
>                     "Hola Raul")
>
> frame:Show(true)
>
> frame2 = wx.wxFrame( wx.NULL,            -- no parent for toplevel windows
>                      wx.wxID_ANY,          -- don't need a wxWindow ID
>                      "Hola Raul2",
>                      wx.wxDefaultPosition, wx.wxSize(168, 100),
>                      wx.wxDEFAULT_FRAME_STYLE)
>
> frame2:Show(true)
>
> wx.wxGetApp():MainLoop()
>
> Print("Lua: Se terminó de ejecutar el script de lua")
>
> And this is my C code:
>
> /*
>  * File:   Main.cpp
>  * Author: raulhuertas
>  *
>  * Created on 21 de noviembre de 2008, 15:32
>  */
>
> #include <stdlib.h>
> #include <lua.hpp>
> #include <iostream>
>
>
> using namespace std;
>
>
> const char* commandFile = "Hello.lua";
>
> /*
>  *
>  */
> int main(int argc, char** argv) {
>
>     lua_State* lua = luaL_newstate();
>     luaL_openlibs( lua );
>
>     cout<<"Version de Lua: "<< LUA_RELEASE <<endl;
>
>     if( luaL_loadfile( lua, "Hello.lua") ){
>         cout<<"Ha habido un error cargando el archivo "<<endl;
>         return(-1);
>     }
>     cout<<"Se cargó el archivo"<<endl;
>         switch( lua_pcall( lua, 0,0,0) ){
>         case 0: cout<<"No hubieron errores interpretando el archivo'"<<endl;
> break;
>         case LUA_ERRRUN: cout<<""<<endl; break;
>         case LUA_ERRMEM: cout<<""<<endl; break;
>         case LUA_ERRERR: cout<<""<<endl; break;
>         default: cout<<"Error desconocido de Lua"<<endl;
>     }
> //load file carga el archivo y su contenido lo coloca en la stack.
>     //Al momento de 'call' una chunk, lo que se realiza es interpretar todo
> su contenido
>
>     cout<<"Se cargó y ejecutó el archivo por completo"<<endl;
>     /******Invocnado Lua desde C*******/
>     //Vamos a llamar la función 'probandoLua' que se definió en el archivo
> anterior
>
>     lua_getfield( lua, LUA_GLOBALSINDEX, "probandoLua");
>     cout<<"get field 'probandolua' "<<endl;
>     lua_pushstring(lua, argv[1] );
>     lua_pushnumber(lua, 12312.56);
>     cout<<"push 1 y push 2 "<<endl;
>     switch( lua_pcall( lua, 2,0,0) ){
>         case 0: cout<<"No hubieron errores llamando la función
> 'probandolua'"<<endl; break;
>         case LUA_ERRRUN: cout<<""<<endl; break;
>         case LUA_ERRMEM: cout<<""<<endl; break;
>         case LUA_ERRERR: cout<<""<<endl; break;
>         default: cout<<"Error desconocido de Lua"<<endl;
>     }
>
>     cout<<"Se va  a llamar a 'luaclose'"<<endl;
>     lua_close(lua);
>
>     int r;
>     cin>>r;
>
>     return (EXIT_SUCCESS);
> }
>
>
> In the wxLua installation files I changed the lua module for the version
> 5.1.4.(else 'make install' would my system lua.h to 5.1.3).
>
> Some help please
>
>
> ________________________________
> Discover the new Windows Vista Learn more!
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> wxlua-users mailing list
> wxlua-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wxlua-users
>
>

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to