Luabind: C++ referenced variables;

hymedia <[email protected]>
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <005b01c99867$1d5d3170$58179450$@ca>
I might have overlooked this  but I can’t find anything replicating this within the examples so far,

 

I m not crazy about using the properties. I d like to keep a C++ structur as much as possible. So here is what I do:

 

.cpp

 

typedef unsigned int UInt;

 

class Test

{

      public:

 

            Test(): val(0) {}

            ~Test() {}

 

            UInt &Get() {return val;}

            void Set(UInt in_val) {val = in_val;}

 

      protected:

 

            UInt val;

};

 

Luabind

 

      module(in_lua)

      [

            class_<Test>("Test")

            .def(constructor<>())

            .def("Get", &Test::Get)

            .def("Set", &Test::Set)

      ];

 

.lua

 

myTest = Test();

myTest:Set(1);

myVal = myTest:Get();

 

Result:

 

myTest:Get(); assert: you are trying to use an unregistered type!

 

I know for sure the typedef is not an issue here, could have been a int, I have no doubts this have been addressed in the pass, but I could definitely use a hint.

 

Thx in advance.

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H

_______________________________________________
luabind-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/luabind-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.