> > Thanks for the really quick reply. I had tried to obtain
> > the value by calling module.ConstName, but it seems like
> > every constant value is not set in LUA. I can even do
> >
> > module.ConstName = SomeValue
> >
> > without any errors. I can access without any problems every
> > swiged functions, just not the variables. I'm probably
> > doing something wrong, but I have no idea what it is.
> > Everything was working correctly with the earlier SWIG
> > version, I just assumed that the _get() functions were
> > removed for the more obvious direct access (which you
> > confirmed was right). Thanks for pointing me in the right
> > direction once again.
> > St?fan Beauchamp
> >
> Hello Stefan,
>
> Here is a simple test program I did:
> --------------------------------
> %module demo;
> %inline %{
> class Foo{};
>
> const Foo F=Foo();
> enum {YES,NO};
> const float PI=3.142;
>
> int i;
> float f;
> %}
> -------------------------------
> And my use (Lua 5.1.3 mingw Windows)
> > require "demo"
> > print(demo.F)
> userdata: 0003CE48
> > print(demo.YES)
> 0
> > print(demo.NO)
> 1
> > print(demo.PI)
> 3.1419999599457
> > demo.i=10
> > print(demo.i)
> 10
> > demo.YES=12
> > print(demo.YES)
> 12
> > demo.PI=3
> This variable is immutable
> stack traceback:
> [C]: ?
> [C]: ?
> stdin:1: in main chunk
> [C]: ?
> >
>
> Note: the enum's are just simple Lua variables, so they can be set to, but both PI and F are immutable and cannot be changed.
>
> Do you get a similar result?
> Regards,
> Mark
>
>

I finally have had the time to take another look at our SWIG problem. It looks like the exemple you've shown me in your previous message works fine. Our problem comes from constant variables in our C++ code. The ilua interface files contain includes for the various code files we need to interface (we don't explicitly extern the const variables in the interface files though, and it was working fine previously) and the generated swig file does seem to have the correct code to make the contants available (ie the swig_variables array contains all the necessary variables, and each of those variables is added through SWIG_Lua_module_add_variable). However, I've printed the module table in a LUA script but haven't seen ANY of the constants available. Every function, class, define, etc. seem to be in the module's table and correctly SWIGed, but not the constant variables. Thanks for pointing me in a direction if you happen to have any idea of what could be causing the problem.


Utilisez Windows Live Messenger pour envoyer des messages sur les cellulaires de vos amis Plus de détails sur notre site PC@cellulaire